unit collision test: writes y and x positon to wram as a return value
authorLukas Krickl <lukas@krickl.dev>
Sun, 10 Aug 2025 19:34:08 +0000 (21:34 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sun, 10 Aug 2025 19:34:08 +0000 (21:34 +0200)
src/unit.s
src/wram.s

index b25c071bfe2ae39abd1e69b4943570feedf59060..e592847176ae84947972f92fa12a448bf7daf32a 100644 (file)
@@ -349,9 +349,15 @@ unit_handle_inputs:
        ;       returns:
        ;               unit_test_collision_cf_flags: 0 if not collided with a tile
        ;                                                                                 FLAGS if collided
+       ;                         _pox_y/x: set to input acot y and x
 #macro unit_test_collision
   ; perform tile collision check
   push de
+       ; write y and x pos
+       ld a, b
+       ld [unit_test_collision_pos_y], a
+       ld a, c
+       ld [unit_test_collision_pos_x], a
   call unit_get_pos
   $1 
   push bc
index 2ea12980f4448dfe0e36a387b5719e644f2b81ec..56cb518edb83c3e30de2e619d76f3cdc13d11015 100644 (file)
@@ -37,6 +37,8 @@ status_text: .adv 32
        ; stores the last collision flag result
        ; that was performed by a test collision call
 unit_test_collision_cf_flags: .adv 1
+unit_test_collision_pos_y: .adv 1
+unit_test_collision_pos_x: .adv 1
 
        ; self modifying code
        ; the vblank interrupt jumps here