diff --git a/src/sig/objects/Player.java b/src/sig/objects/Player.java index 0df9e52..8ca4152 100644 --- a/src/sig/objects/Player.java +++ b/src/sig/objects/Player.java @@ -6,6 +6,7 @@ import sig.engine.Panel; import sig.engine.Rectangle; import sig.engine.Sprite; import sig.engine.Transform; +import sig.engine.objects.AnimatedObject; import sig.map.Map; import sig.map.Tile; import sig.map.View; @@ -396,6 +397,28 @@ public class Player extends PhysicsObject{ RabiClone.level_renderer.setY(newY < 0 ? 0 : newY); } + @Override + public void collisionEvent(AnimatedObject obj) { + if (state==State.BELLYSLIDE) { + if(obj instanceof PhysicsObject){ + PhysicsObject pobj = (PhysicsObject)obj; + if(pobj.state!=State.STAGGER){ + if(facing_direction){ + pobj.staggerDuration=0.3; + pobj.x_velocity = -300; + pobj.y_velocity = -120; + pobj.state = State.STAGGER; + }else{ + pobj.staggerDuration=0.3; + pobj.x_velocity = 300; + pobj.y_velocity = -120; + pobj.state = State.STAGGER; + } + } + } + } + } + @Override public void draw(byte[] p) { } diff --git a/src/sig/objects/actor/PhysicsObject.java b/src/sig/objects/actor/PhysicsObject.java index 9dd23b4..364a141 100644 --- a/src/sig/objects/actor/PhysicsObject.java +++ b/src/sig/objects/actor/PhysicsObject.java @@ -61,10 +61,12 @@ public abstract class PhysicsObject extends AnimatedObject implements PhysicsObj Math.abs(x_velocity+x_acceleration*updateMult)>x_velocity_limit ?Math.signum(x_velocity+x_acceleration*updateMult)*x_velocity_limit :x_velocity+x_acceleration*updateMult; - y_velocity = - Math.abs(y_velocity+y_acceleration*updateMult)>y_velocity_limit - ?Math.signum(y_velocity+y_acceleration*updateMult)*y_velocity_limit - :y_velocity+y_acceleration*updateMult; + if (state!=State.BELLYSLIDE) { + y_velocity = + Math.abs(y_velocity+y_acceleration*updateMult)>y_velocity_limit + ?Math.signum(y_velocity+y_acceleration*updateMult)*y_velocity_limit + :y_velocity+y_acceleration*updateMult; + } double displacement_y = y_velocity*updateMult; double displacement_x = x_velocity*updateMult; @@ -132,9 +134,6 @@ public abstract class PhysicsObject extends AnimatedObject implements PhysicsObj if(y_velocity>0 && state!=State.SLIDE&&state!=State.BELLYSLIDE){ state = State.FALLING; } - if (y_velocity>FALLING_SPEED_LIMIT&&state!=State.BELLYSLIDE) { - y_velocity=FALLING_SPEED_LIMIT; - } if (!sideCollision) { handleKeyboardMovement(updateMult, right-left, horizontal_air_friction, horizontal_air_drag); this.setX(this.getX()+displacement_x); diff --git a/src/sig/objects/weapons/KnifeSwing.java b/src/sig/objects/weapons/KnifeSwing.java index 4491bcd..5f70927 100644 --- a/src/sig/objects/weapons/KnifeSwing.java +++ b/src/sig/objects/weapons/KnifeSwing.java @@ -34,7 +34,6 @@ public class KnifeSwing extends AttachableObject{ @Override public void collisionEvent(AnimatedObject obj) { - //System.out.println("Bonk"); if(obj instanceof PhysicsObject){ PhysicsObject pobj = (PhysicsObject)obj; if(pobj.state!=State.STAGGER){ diff --git a/src/sig/objects/weapons/KnifeSwing2.java b/src/sig/objects/weapons/KnifeSwing2.java index 83afb83..62718af 100644 --- a/src/sig/objects/weapons/KnifeSwing2.java +++ b/src/sig/objects/weapons/KnifeSwing2.java @@ -34,7 +34,6 @@ public class KnifeSwing2 extends AttachableObject{ @Override public void collisionEvent(AnimatedObject obj) { - //System.out.println("Bonk"); if(obj instanceof PhysicsObject){ PhysicsObject pobj = (PhysicsObject)obj; if(pobj.state!=State.STAGGER){