Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getDist(firstObject:Object,secondObject:Object) {
- var distance:Number = Math.sqrt( ( firstObject.x - secondObject.x ) * ( firstObject.x - secondObject.x ) + ( firstObject.y - secondObject.y ) * ( firstObject.y - secondObject.y ) );
- return distance;
- }
- // example
- if(getDist(firstThing,secondThing) <= tooCloseRadius){
- firstThing.move();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement