From 2ef6563a643054ab4a5555f3bbe8703bd07ef234 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sun, 10 Aug 2025 21:34:08 +0200 Subject: [PATCH] unit collision test: writes y and x positon to wram as a return value --- src/unit.s | 6 ++++++ src/wram.s | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/unit.s b/src/unit.s index b25c071..e592847 100644 --- a/src/unit.s +++ b/src/unit.s @@ -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 diff --git a/src/wram.s b/src/wram.s index 2ea1298..56cb518 100644 --- a/src/wram.s +++ b/src/wram.s @@ -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 -- 2.30.2