working on canceling scrolls when camera cannot move
authorLukas Krickl <lukas@krickl.dev>
Wed, 26 Mar 2025 16:48:05 +0000 (17:48 +0100)
committerLukas Krickl <lukas@krickl.dev>
Wed, 26 Mar 2025 16:48:05 +0000 (17:48 +0100)
src/player.s

index b06eff986d71c8e904e8eb37fefe81ab07360e7f..bd45c1177f4815df47891337166c6de62aa09860 100644 (file)
@@ -123,6 +123,7 @@ cursor_move:
   ; if timer is 0 apply movement 
   ; and jump to next tile
     call try_abort_move
+    jp z, @done
 
     ld a, [cursor_y]
     ld b, a
@@ -149,15 +150,19 @@ try_abort_move:
   ld hl, cursor_x
   ld de, cursor_move_x
   call try_abort_move_at
+  ret z
 
+  ; TODO check other directions here
   ret
 
+
   ; aborts a move direciton  
   ; inputs: 
   ;   b: compare variable (e.g. min or max value)
   ;   c: move direction compare value (e.g. move + or -)
   ;  hl: position ptr
   ;  de: move variable to set to 0
+  ; returns: z == 0 if move was aborted 
 try_abort_move_at:
   ; do not abort if position is wrong
   ld a, [hl]
@@ -172,4 +177,5 @@ try_abort_move_at:
   xor a, a
   ld [de], a
 
+  ; z = 0 due to xor a, a
   ret