fixed double jump

the player can no longer jump twice in the air if they walk off a ledge
This commit is contained in:
Sam 2023-05-01 02:12:06 -07:00
parent 932af31dc9
commit 61939d5090

View File

@ -37,6 +37,7 @@ public class PlayerMovement : MonoBehaviour
//Jump //Jump
private bool _isJumpCut; private bool _isJumpCut;
private bool _isJumpFalling; private bool _isJumpFalling;
private bool isRegFalling;
//Wall Jump //Wall Jump
private float _wallJumpStartTime; private float _wallJumpStartTime;
@ -131,9 +132,20 @@ public class PlayerMovement : MonoBehaviour
if (unlockedTrumpet) { if (unlockedTrumpet) {
trumpet = 2; trumpet = 2;
} else { } else {
trumpet = 0; trumpet = -1;
} }
wasGrappling = false; wasGrappling = false;
isRegFalling = false;
} else {
// print("not jumping");
if(!_isJumpFalling && !isRegFalling) {
if(unlockedTrumpet) {
trumpet = 1;
} else {
trumpet = -1;
}
isRegFalling = true;
}
} }
//Right Wall Check //Right Wall Check
@ -155,7 +167,7 @@ public class PlayerMovement : MonoBehaviour
if (IsJumping && RB.velocity.y <= 0) if (IsJumping && RB.velocity.y <= 0)
{ {
IsJumping = false; IsJumping = false;
print("isJumping " + IsJumping); // print("isJumping " + IsJumping);
if (!IsWallJumping) if (!IsWallJumping)
_isJumpFalling = true; _isJumpFalling = true;