diff --git a/src/sig/objects/Erinoah.java b/src/sig/objects/Erinoah.java index 8fd6a31..67fd0a3 100644 --- a/src/sig/objects/Erinoah.java +++ b/src/sig/objects/Erinoah.java @@ -15,6 +15,11 @@ public class Erinoah extends PhysicsObject implements RenderedObject{ setY(y); } + @Override + public Rectangle setCollisionBounds() { + return new Rectangle(12,4,24,38); + } + @Override public void update(double updateMult) { super.update(updateMult); @@ -31,18 +36,11 @@ public class Erinoah extends PhysicsObject implements RenderedObject{ @Override public boolean rightKeyHeld() { - // TODO Auto-generated method stub return false; } @Override public boolean leftKeyHeld() { - // TODO Auto-generated method stub return false; } - - @Override - public Rectangle getCollisionBounds() { - return new Rectangle(8,2,16,30); - } } diff --git a/src/sig/objects/Player.java b/src/sig/objects/Player.java index 3042730..d94220b 100644 --- a/src/sig/objects/Player.java +++ b/src/sig/objects/Player.java @@ -66,7 +66,11 @@ public class Player extends PhysicsObject implements RenderedObject{ super(Sprite.ERINA, 5, panel); setX(RabiClone.BASE_WIDTH / 2 - getAnimatedSpr().getWidth() / 2); setY(RabiClone.BASE_HEIGHT * (2 / 3d) - getAnimatedSpr().getHeight() / 2); - setCollisionBounds(new Rectangle(10,2,12,27)); + } + + @Override + public Rectangle setCollisionBounds() { + return new Rectangle(10,2,12,27); } @Override diff --git a/src/sig/objects/actor/PhysicsObject.java b/src/sig/objects/actor/PhysicsObject.java index 083a3b0..465108f 100644 --- a/src/sig/objects/actor/PhysicsObject.java +++ b/src/sig/objects/actor/PhysicsObject.java @@ -26,6 +26,7 @@ public abstract class PhysicsObject extends AnimatedObject implements PhysicsObj protected PhysicsObject(AnimatedSprite spr, double animationSpd, Panel panel) { super(spr, animationSpd, panel); + setCollisionBox(setCollisionBounds()); } @Override @@ -214,10 +215,5 @@ public abstract class PhysicsObject extends AnimatedObject implements PhysicsObj public Rectangle getCollisionBounds() { return getCollisionBox(); } - - @Override - public void setCollisionBounds(Rectangle bounds) { - setCollisionBox(bounds); - } } diff --git a/src/sig/objects/actor/PhysicsObjectRequirements.java b/src/sig/objects/actor/PhysicsObjectRequirements.java index 3a24bca..fbfb612 100644 --- a/src/sig/objects/actor/PhysicsObjectRequirements.java +++ b/src/sig/objects/actor/PhysicsObjectRequirements.java @@ -6,5 +6,5 @@ public interface PhysicsObjectRequirements { boolean rightKeyHeld(); boolean leftKeyHeld(); Rectangle getCollisionBounds(); - void setCollisionBounds(Rectangle bounds); + Rectangle setCollisionBounds(); }