Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function isColliding( a : GameObject, b : GameObject ) : Boolean
- {
- var collthreshSquared : Number = a.radius + b.radius;
- if ( collthreshSquared < Math.abs(a._position.x - b._position.x) )
- return false;
- if ( collthreshSquared < Math.abs(a._position.y - b._position.y) )
- return false;
- var atob : Vec2D = a._position.subtract( b._position );
- var lengthSquared : Number = atob.lengthSquared();
- collthreshSquared *= collthreshSquared;
- if ( lengthSquared > collthreshSquared )
- {
- return false;
- }
- return true;
- }
Add Comment
Please, Sign In to add comment