ActionScript: Get distance between 2 MovieClips

Share

If you want to get the distance in pixels between 2 graphic objects just use the Pythagorean theorem in ActionScript :). c² = a² + b² Download source : Get_Distance.zip 12345function getDistance(pObj1:MovieClip,pObj2:MovieClip):Number {     var distX:Number = pObj1.x – pObj2.x;     var distY:Number = pObj1.y [...]

Posted on Thursday November 25th, 2010 at 03:09 PM by admin · Permalink · One Comment
Share

In: ActionScript3 as3, Game Design, Tip, Tutorial · Tagged with: , , , , ,