From 835b88f1f43dc01fbe3f223aa9acab846c241479 Mon Sep 17 00:00:00 2001 From: En Yi Date: Mon, 2 Oct 2023 22:49:55 +0800 Subject: [PATCH] Fix coyote jump issue Changelog: - Add check for coyote timer when jumping - Set ladder state AFTER the jump check --- scenes/game_systems.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scenes/game_systems.c b/scenes/game_systems.c index 3f4f4c7..0257a66 100644 --- a/scenes/game_systems.c +++ b/scenes/game_systems.c @@ -362,11 +362,10 @@ void player_movement_input_system(Scene_t* scene) // Check if possible to jump when jump is pressed if (p_cjump->jump_released && p_pstate->jump_pressed && p_cjump->jumps > 0 && p_cjump->jump_ready) { - p_pstate->ladder_state = false; p_cjump->jumps--; if (!in_water) { - if (p_mstate->ground_state & 1) + if (p_mstate->ground_state & 1 || p_cjump->coyote_timer > 0) { p_ctransform->velocity.y = -p_cjump->jump_speed; } @@ -380,6 +379,7 @@ void player_movement_input_system(Scene_t* scene) p_ctransform->velocity.y = -p_cjump->jump_speed / 1.75; } + p_pstate->ladder_state = false; p_cjump->coyote_timer = 0; p_cjump->jumped = true; p_cjump->jump_ready = false;