player: Added cap for right and bottom of screen when moving
authorLukas Krickl <lukas@krickl.dev>
Fri, 26 Sep 2025 16:58:47 +0000 (18:58 +0200)
committerLukas Krickl <lukas@krickl.dev>
Fri, 26 Sep 2025 16:58:47 +0000 (18:58 +0200)
src/player.s

index 25b245d2859f6cb017618331989c27d74c514411..d0102a31f91d49ae1ecbc47aa707e53a2e90f505 100644 (file)
@@ -129,6 +129,12 @@ player_stage_move_p:
        jr nc, @no_overflow_y REL
                ld a, 0xFF
 @no_overflow_y:
+       
+       ; bottom of screen
+       cp a, 0x60
+       jr c, @no_edge_y REL
+               ld a, 0x60
+@no_edge_y:    
 
        ld b, a
 
@@ -141,6 +147,13 @@ player_stage_move_p:
 jr nc, @no_overflow_x REL
                ld a, 0xFF
 @no_overflow_x:
+       
+       ; right side of screen
+       cp a, 0x90
+       jr c, @no_edge_x REL
+               ld a, 0x90
+@no_edge_x:
+
        ld c, a
        
        ret