From 24b306145f3e2add05b0074c3ed7df9ae5deefa6 Mon Sep 17 00:00:00 2001 From: Zakarya Date: Sat, 20 Jan 2024 19:19:13 -0800 Subject: [PATCH] Fix sprinting issue with toggle sprint --- addons/fpc/character.gd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/fpc/character.gd b/addons/fpc/character.gd index 0449104..36c9b26 100644 --- a/addons/fpc/character.gd +++ b/addons/fpc/character.gd @@ -167,6 +167,9 @@ func handle_state(moving): enter_normal_state() elif sprint_mode == 1: if moving: + # If the player is holding sprint before moving, handle that cenerio + if Input.is_action_pressed(SPRINT) and state == "normal": + enter_sprint_state() if Input.is_action_just_pressed(SPRINT): match state: "normal": @@ -178,7 +181,7 @@ func handle_state(moving): if crouch_enabled: if crouch_mode == 0: - if Input.is_action_pressed(CROUCH) and !Input.is_action_pressed(SPRINT): + if Input.is_action_pressed(CROUCH) and state != "sprinting": if state != "crouching": enter_crouch_state() elif state == "crouching" and !$CrouchCeilingDetection.is_colliding():