Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //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());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement