i’m writing a game. in the game (in as2), there is an object and a point. the point is moving around an elliptical path. when clicked, the object moves towards the point until it is within five pixels, then it moves to the point every frame so that it is moving around the ellipse with it. the problem that i am having is that when the object reaches the point, it doesn’t stop moving towards it. the object jumps back and forth over the point. the problem isn’t that it’s not getting close enough for the distance check to work, the minimum distance is more than high enough. i’m guessing the problem is with my distance formula, but i can’t see any problem with it:
Math.sqrt(Math.pow(_root.Demon._y + (10 * Math.cos(RevDegree * (Math.PI / 180))) - this._y, 2) + Math.pow(_root.Demon._x + (75 * Math.sin(RevDegree * (Math.PI / 180))) - this._x, 2))
Demon is the object that the elliptical path is going around, RevDegree is the degree that the point is at in the ellipse, it increases every frame.