After reviewing, keyboard release restriction doesn't seem necessary and just produces stiff jump bug movement with multiple inputs
Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com> Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
36aa9cd7fe
commit
e67685ba47
@ -40,8 +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;
|
||||||
|
|
||||||
@ -257,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))) {
|
||||||
@ -303,10 +300,9 @@ public class Player extends PhysicsObject{
|
|||||||
// System.out.println("Queue up slide.");
|
// System.out.println("Queue up slide.");
|
||||||
}
|
}
|
||||||
case JUMP:
|
case JUMP:
|
||||||
if (jumpCount > 0 && spacebarReleased && (a == Action.JUMP)) {
|
if (jumpCount > 0 && (a == Action.JUMP)) {
|
||||||
jumpCount = 0;
|
jumpCount = 0;
|
||||||
y_velocity = jump_velocity;
|
y_velocity = jump_velocity;
|
||||||
spacebarReleased = false;
|
|
||||||
spacebarPressed = RabiClone.TIME;
|
spacebarPressed = RabiClone.TIME;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -332,13 +328,11 @@ public class Player extends PhysicsObject{
|
|||||||
state=State.ATTACK;
|
state=State.ATTACK;
|
||||||
weaponSwingTime=RabiClone.TIME;
|
weaponSwingTime=RabiClone.TIME;
|
||||||
}
|
}
|
||||||
if (groundCollision) {
|
if (groundCollision||isUnderwater()) {
|
||||||
if (spacebarReleased && (a == Action.JUMP) && jumpCount > 0
|
if (a==Action.JUMP&&state!=State.ATTACK2&&state!=State.ATTACK3) {
|
||||||
&&state!=State.ATTACK2&&state!=State.ATTACK3) {
|
|
||||||
state = State.JUMP;
|
state = State.JUMP;
|
||||||
jumpCount--;
|
jumpCount--;
|
||||||
y_velocity = jump_velocity;
|
y_velocity = jump_velocity;
|
||||||
spacebarReleased = false;
|
|
||||||
spacebarPressed = RabiClone.TIME;
|
spacebarPressed = RabiClone.TIME;
|
||||||
// System.out.println("Jump");
|
// System.out.println("Jump");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user