SHARE
TWEET

intersectsAABB (Intro Android 2018)

ulfben Jan 28th, 2018 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //for Entity.java
  2. public boolean isColliding(Entity that){
  3.     return Entity.intersectsAABB(this, that);
  4. }
  5.  
  6. public void onCollision(Entity that){
  7.     // no default implementation
  8. }
  9.  
  10. public static boolean intersectsAABB(Entity a, Entity b) {
  11.     return !(a.right() < b.left()
  12.             || b.right() < a.left()
  13.             || a.bottom() < b.top()
  14.             || b.bottom() < a.top());
  15. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top