A-movieclip represented by a circle
B-movieclip represented by a circle
I need an equation to move the point A to B.
Problem: The basic equation (X-Xa)/(Xb-Xa)=(Y-Ya)/(Yb-Ya) gets bugged if the point B changes his position.
where: Xa, Xb, Ya, Yb are the initial coordonates of the 2 points. Those should not change.
Xa will be saved in var a;
Xb in var b;
Ya in a2
Yb in b2
Possible Solution: When Point B changes his possition, his X and Y saved will be re-memorated in 2 variables.
Actionscript won’t solve equations for you. To move a movieclip, you need to give specific instructions for where you want it to go. A common way to animate a movieclip is to set an x velocity and y velocity, and use them to modify the location of the clip each frame:
//I defined CircleAVelocity as a point so I can store X and Y velocity in a single variable
CircleAMovieClip.x += CircleAVelocity.x;
CircleAMovieClip.y += CircleAVelocity.y;
If the target location moves, you will need to recalculate CircleAVelocity every frame.