ulfben

intersectsAABB (Intro Android 2018)

Jan 28th, 2018
142
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

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×