Point Towards (x,y)

  scripts
  sprites
See inside
Notes and Credits

A simple script that allows a sprite to point towards a co-ordinate (x,y).

How does it work?
dy and dx are the differences between the co-ordinate and out sprites co-ordinates. dy/dx here acts as finding the value of the opposite/adjacent. We could also do sqrt(dy^2 + dx^2) to find the exact distance to the point also.
Then we turn through the angle of atan(dy/dx) to point towards the co-ordinate.

NOTE!

To cut down on variables, you can replace myx and myy with xpos and ypos.

Shared: 20 May 2012 Modified: 20 May 2012
Favorite this project 0
Love this project 0
Total views 106
View the remix tree  1
  
More projects by Prestige-test