Setup physics for Erinoah

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 2 years ago committed by GitHub
parent 8e35ea24d7
commit 3d2973c5b1
  1. 12
      src/sig/objects/Erinoah.java
  2. 6
      src/sig/objects/Player.java
  3. 6
      src/sig/objects/actor/PhysicsObject.java
  4. 2
      src/sig/objects/actor/PhysicsObjectRequirements.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);
}
}

@ -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

@ -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
@ -215,9 +216,4 @@ public abstract class PhysicsObject extends AnimatedObject implements PhysicsObj
return getCollisionBox();
}
@Override
public void setCollisionBounds(Rectangle bounds) {
setCollisionBox(bounds);
}
}

@ -6,5 +6,5 @@ public interface PhysicsObjectRequirements {
boolean rightKeyHeld();
boolean leftKeyHeld();
Rectangle getCollisionBounds();
void setCollisionBounds(Rectangle bounds);
Rectangle setCollisionBounds();
}

Loading…
Cancel
Save