|
|
@ -40,6 +40,7 @@ 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; |
|
|
|
|
|
|
|
|
|
|
@ -211,7 +212,7 @@ 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(state);
|
|
|
|
System.out.println(spacebarReleased); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void handleEventCollisions() { |
|
|
|
private void handleEventCollisions() { |
|
|
@ -255,6 +256,7 @@ 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))) { |
|
|
@ -329,12 +331,13 @@ public class Player extends PhysicsObject{ |
|
|
|
weaponSwingTime=RabiClone.TIME; |
|
|
|
weaponSwingTime=RabiClone.TIME; |
|
|
|
} |
|
|
|
} |
|
|
|
if (groundCollision||isUnderwater()) { |
|
|
|
if (groundCollision||isUnderwater()) { |
|
|
|
if (a==Action.JUMP&&state!=State.ATTACK2&&state!=State.ATTACK3) { |
|
|
|
if (spacebarReleased&&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; |
|
|
|
// System.out.println("Jump");
|
|
|
|
spacebarReleased=false; |
|
|
|
|
|
|
|
System.out.println("Jump"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (state != State.SLIDE&&state!=State.BELLYSLIDE) { |
|
|
|
if (state != State.SLIDE&&state!=State.BELLYSLIDE) { |
|
|
|