MoveTowardsPoint2D
Revision as of 12:11, 18 October 2011 by Jasper van Loenen (talk | contribs)
Just the formula for now, no code examples (yet)
object = thing to move, target = where to move
direction = atan2(targetY-objectY, targetX - objectX)*180/PI;
objectx += cos(direction*PI/180)*movingSpeed;
objecty += sin(direction*PI/180)*movingSpeed;