From d6fab4439f266cb4b4bf42835c16bd6026df602a Mon Sep 17 00:00:00 2001 From: mushgunAX Date: Thu, 24 Nov 2022 21:56:06 +0800 Subject: [PATCH] Made player jumping more responsive - Changed the input check in the jump function from a GetKeyDown() / GetKeyUp() to a GetKey() / !GetKey() - This makes jumping a lot more responsive - This also means holding the jump button causes the raccoon to "bunny hop" until jump button is released --- Assets/Scripts/Gameplay/Player/SC_PlayerController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs b/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs index b8a096e9..ac00e5f7 100644 --- a/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs +++ b/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs @@ -285,7 +285,7 @@ public class PlayerController : Script { if (currentState == RaccoonStates.WALKING || currentState == RaccoonStates.RUNNING || currentState == RaccoonStates.IDLE) { - if (Input.GetKeyDown(Input.KeyCode.Space) && isGrounded && rb != null) + if (Input.GetKey(Input.KeyCode.Space) && isGrounded && rb != null) { currentState = RaccoonStates.JUMP; Vector3 v = rb.LinearVelocity; @@ -304,7 +304,7 @@ public class PlayerController : Script } } - if(!isGrounded && rb != null && (rb.LinearVelocity.y < 0.0f || Input.GetKeyUp(Input.KeyCode.Space))) + if(!isGrounded && rb != null && (rb.LinearVelocity.y < 0.0f || !Input.GetKey(Input.KeyCode.Space))) currentState = RaccoonStates.FALLING; }