From 9575262ee8ec5b6edf75072437e85db6ed2257ca Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Wed, 24 Sep 2025 05:33:21 +0200 Subject: [PATCH] player: scroll only happens if a move was made --- src/player.s | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/player.s b/src/player.s index 1794ae3..f7064a2 100644 --- a/src/player.s +++ b/src/player.s @@ -17,11 +17,15 @@ player_update: ld b, BTNUP input_held jr z, @not_up REL - call player_try_scroll_up ld b, PLAYER_SPEED ld c, 0 call player_stage_move_n call player_try_move + + ; only scroll if player actually moved + cp a, 0 + jr nz, @not_up REL + call player_try_scroll_up @not_up: ld b, BTNDOWN @@ -147,6 +151,9 @@ player_stage_move_n: ; moves scroll and performs map loads if needed ; inputs: ; b/c: new y/x position + ; returns: + ; a: 1 == collision + ; a: 0 no collision player_try_move: ; write temporary collider push bc @@ -170,7 +177,8 @@ player_try_move: ld a, c ld [player+act_pos_x], a - + + xor a, a ret ; draws the special player actor -- 2.30.2