daily pastebin goal
34%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private function isColliding( a : GameObject, b : GameObject ) : Boolean
  2.         {
  3.             var collthreshSquared : Number = a.radius + b.radius;
  4.            
  5.             if ( collthreshSquared < Math.abs(a._position.x - b._position.x) )
  6.                 return false;
  7.                
  8.             if ( collthreshSquared < Math.abs(a._position.y - b._position.y) )
  9.                 return false;  
  10.            
  11.             var atob : Vec2D = a._position.subtract( b._position );
  12.             var lengthSquared : Number = atob.lengthSquared();
  13.             collthreshSquared *= collthreshSquared;
  14.            
  15.             if ( lengthSquared > collthreshSquared )
  16.             {
  17.                 return false;
  18.             }
  19.            
  20.             return true;
  21.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top