player: scroll only happens if a move was made
authorLukas Krickl <lukas@krickl.dev>
Wed, 24 Sep 2025 03:33:21 +0000 (05:33 +0200)
committerLukas Krickl <lukas@krickl.dev>
Wed, 24 Sep 2025 03:33:21 +0000 (05:33 +0200)
src/player.s

index 1794ae363a8fcf2f1931b95a9350c75fbadb7aed..f7064a2af20a7ef4e0ea336b30e954f1f5de6a8b 100644 (file)
@@ -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