|
|
@ -40,7 +40,6 @@ public class Player extends PhysicsObject{ |
|
|
|
final double viewBoundaryX = RabiClone.BASE_WIDTH / 3; |
|
|
|
final double viewBoundaryX = RabiClone.BASE_WIDTH / 3; |
|
|
|
final double viewBoundaryY = RabiClone.BASE_HEIGHT / 3; |
|
|
|
final double viewBoundaryY = RabiClone.BASE_HEIGHT / 3; |
|
|
|
View lastCameraView = View.FIXED; |
|
|
|
View lastCameraView = View.FIXED; |
|
|
|
boolean spacebarReleased = true; |
|
|
|
|
|
|
|
boolean facing_direction = RIGHT; |
|
|
|
boolean facing_direction = RIGHT; |
|
|
|
boolean landedBellySlide=false; |
|
|
|
boolean landedBellySlide=false; |
|
|
|
|
|
|
|
|
|
|
@ -68,6 +67,7 @@ public class Player extends PhysicsObject{ |
|
|
|
setSlidingVelocity_UseDefaultStrategy(); |
|
|
|
setSlidingVelocity_UseDefaultStrategy(); |
|
|
|
setSlidingAcceleration_UseDefaultStrategy(); |
|
|
|
setSlidingAcceleration_UseDefaultStrategy(); |
|
|
|
setJumpVelocity_UseDefaultStrategy(); |
|
|
|
setJumpVelocity_UseDefaultStrategy(); |
|
|
|
|
|
|
|
setMaxJumpCount_UseDefaultStrategy(); |
|
|
|
setGravity_UseDefaultStrategy(); |
|
|
|
setGravity_UseDefaultStrategy(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -212,7 +212,6 @@ public class Player extends PhysicsObject{ |
|
|
|
&& state!=State.ATTACK2&&state!=State.ATTACK3&&state!=State.BELLYSLIDE) { |
|
|
|
&& state!=State.ATTACK2&&state!=State.ATTACK3&&state!=State.BELLYSLIDE) { |
|
|
|
y_velocity = jump_velocity; |
|
|
|
y_velocity = jump_velocity; |
|
|
|
} |
|
|
|
} |
|
|
|
System.out.println(spacebarReleased); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void handleEventCollisions() { |
|
|
|
private void handleEventCollisions() { |
|
|
@ -235,16 +234,16 @@ public class Player extends PhysicsObject{ |
|
|
|
if (state!=State.UNCONTROLLABLE) { |
|
|
|
if (state!=State.UNCONTROLLABLE) { |
|
|
|
setUncontrollable(0.2); |
|
|
|
setUncontrollable(0.2); |
|
|
|
} |
|
|
|
} |
|
|
|
pobj.setStagger(0.3); |
|
|
|
pobj.setStagger(0.5); |
|
|
|
pobj.setInvulnerability(0.4); |
|
|
|
pobj.setInvulnerability(0.6); |
|
|
|
pobj.x_velocity = -300; |
|
|
|
pobj.x_velocity = -300; |
|
|
|
pobj.y_velocity = -120; |
|
|
|
pobj.y_velocity = -120; |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
if (state!=State.UNCONTROLLABLE) { |
|
|
|
if (state!=State.UNCONTROLLABLE) { |
|
|
|
setUncontrollable(0.2); |
|
|
|
setUncontrollable(0.2); |
|
|
|
} |
|
|
|
} |
|
|
|
pobj.setStagger(0.3); |
|
|
|
pobj.setStagger(0.5); |
|
|
|
pobj.setInvulnerability(0.4); |
|
|
|
pobj.setInvulnerability(0.6); |
|
|
|
pobj.x_velocity = 300; |
|
|
|
pobj.x_velocity = 300; |
|
|
|
pobj.y_velocity = -120; |
|
|
|
pobj.y_velocity = -120; |
|
|
|
} |
|
|
|
} |
|
|
@ -256,7 +255,6 @@ public class Player extends PhysicsObject{ |
|
|
|
public void KeyReleased(Action a) { |
|
|
|
public void KeyReleased(Action a) { |
|
|
|
if (a == Action.JUMP) { |
|
|
|
if (a == Action.JUMP) { |
|
|
|
spacebarPressed = 0; |
|
|
|
spacebarPressed = 0; |
|
|
|
spacebarReleased=true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (state != State.SLIDE&&state!=State.BELLYSLIDE) { |
|
|
|
if (state != State.SLIDE&&state!=State.BELLYSLIDE) { |
|
|
|
if ((a == Action.MOVE_LEFT) && (KeyHeld(Action.MOVE_RIGHT))) { |
|
|
|
if ((a == Action.MOVE_LEFT) && (KeyHeld(Action.MOVE_RIGHT))) { |
|
|
@ -331,13 +329,12 @@ public class Player extends PhysicsObject{ |
|
|
|
weaponSwingTime=RabiClone.TIME; |
|
|
|
weaponSwingTime=RabiClone.TIME; |
|
|
|
} |
|
|
|
} |
|
|
|
if (groundCollision||isUnderwater()) { |
|
|
|
if (groundCollision||isUnderwater()) { |
|
|
|
if (spacebarReleased&&jumpCount>0&&a==Action.JUMP&&state!=State.ATTACK2&&state!=State.ATTACK3) { |
|
|
|
if (jumpCount>0&&a==Action.JUMP&&state!=State.ATTACK2&&state!=State.ATTACK3) { |
|
|
|
state = State.JUMP; |
|
|
|
state = State.JUMP; |
|
|
|
jumpCount--; |
|
|
|
jumpCount--; |
|
|
|
y_velocity = jump_velocity; |
|
|
|
y_velocity = jump_velocity; |
|
|
|
spacebarPressed = RabiClone.TIME; |
|
|
|
spacebarPressed = RabiClone.TIME; |
|
|
|
spacebarReleased=false; |
|
|
|
//System.out.println("Jump");
|
|
|
|
System.out.println("Jump"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (state != State.SLIDE&&state!=State.BELLYSLIDE) { |
|
|
|
if (state != State.SLIDE&&state!=State.BELLYSLIDE) { |
|
|
|