intersectsAABB (Intro Android 2018)
//for Entity.java
public boolean isColliding(Entity that){
return Entity.intersectsAABB(this, that);
}
public void onCollision(Entity that){
// no default implementation
}
public static boolean intersectsAABB(Entity a, Entity b) {
return !(a.right() < b.left()
|| b.right() < a.left()
|| a.bottom() < b.top()
|| b.bottom() < a.top());
}
Comments
0 B
|0 👍
/0 👎
0 B
|0 👍
/0 👎