From e67685ba4792b41d43bc6d9f66daea7e5349b230 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Mon, 27 Jun 2022 15:54:16 +0000 Subject: [PATCH] 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 --- src/sig/objects/Player.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/sig/objects/Player.java b/src/sig/objects/Player.java index 99161a6..83bbe56 100644 --- a/src/sig/objects/Player.java +++ b/src/sig/objects/Player.java @@ -40,8 +40,6 @@ public class Player extends PhysicsObject{ final double viewBoundaryX = RabiClone.BASE_WIDTH / 3; final double viewBoundaryY = RabiClone.BASE_HEIGHT / 3; View lastCameraView = View.FIXED; - - boolean spacebarReleased = true; boolean facing_direction = RIGHT; boolean landedBellySlide=false; @@ -257,7 +255,6 @@ public class Player extends PhysicsObject{ public void KeyReleased(Action a) { if (a == Action.JUMP) { spacebarPressed = 0; - spacebarReleased = true; } if (state != State.SLIDE&&state!=State.BELLYSLIDE) { if ((a == Action.MOVE_LEFT) && (KeyHeld(Action.MOVE_RIGHT))) { @@ -303,10 +300,9 @@ public class Player extends PhysicsObject{ // System.out.println("Queue up slide."); } case JUMP: - if (jumpCount > 0 && spacebarReleased && (a == Action.JUMP)) { + if (jumpCount > 0 && (a == Action.JUMP)) { jumpCount = 0; y_velocity = jump_velocity; - spacebarReleased = false; spacebarPressed = RabiClone.TIME; } break; @@ -332,13 +328,11 @@ public class Player extends PhysicsObject{ state=State.ATTACK; weaponSwingTime=RabiClone.TIME; } - if (groundCollision) { - if (spacebarReleased && (a == Action.JUMP) && jumpCount > 0 - &&state!=State.ATTACK2&&state!=State.ATTACK3) { + if (groundCollision||isUnderwater()) { + if (a==Action.JUMP&&state!=State.ATTACK2&&state!=State.ATTACK3) { state = State.JUMP; jumpCount--; y_velocity = jump_velocity; - spacebarReleased = false; spacebarPressed = RabiClone.TIME; // System.out.println("Jump"); }