From: Lukas Krickl Date: Wed, 24 Sep 2025 03:33:21 +0000 (+0200) Subject: player: scroll only happens if a move was made X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=9575262ee8ec5b6edf75072437e85db6ed2257ca;p=gbrg%2F.git player: scroll only happens if a move was made --- 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