How can I get the distance btween two MCs?
Printable View
How can I get the distance btween two MCs?
first get the distance between their _x's, then the distance between their _y's. this can be used to draw a right triangle in which the hypotenuse is the line between the two mcs. using some elementary trig/geometry, we know that the square of the hyp. is equal to the sum of the squares of the two sides, so...
dx=mc1._x-mc2._x;
dy=mc1._y-mc2._y;
dist=Math.sqrt(dx*dx+dy*dy);
Cool It worked Thanks!