//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()); }