From ba3b7d077f981511fa47799929d449134d461c21 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sun, 22 Jun 2025 07:47:19 +0200 Subject: [PATCH] unit: the player unit can now move in multiple directions on the same frame --- src/unit.s | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/unit.s b/src/unit.s index 4b2420e..c9618ef 100644 --- a/src/unit.s +++ b/src/unit.s @@ -145,39 +145,51 @@ unit_generic_draw: ; hl: action table ; a: remaining moves unit_handle_inputs: + ; push next state to the stack for now + ld bc, NULL + push bc + input_held BTNUP jr z, @notup REL call unit_try_move_up + + pop bc ld bc, st_unit_delay_to_active - ret + push bc @notup: input_held BTNDOWN jr z, @notdown REL call unit_try_move_down + + pop bc ld bc, st_unit_delay_to_active - ret + push bc @notdown: input_held BTNLEFT jr z, @notleft REL call unit_try_move_left + + pop bc ld bc, st_unit_delay_to_active - ret + push bc @notleft: input_held BTNRIGHT jr z, @notright REL call unit_try_move_right + + pop bc ld bc, st_unit_delay_to_active - ret + push bc @notright: - - ldnull bc + + pop bc ret ; performs a generic collision test -- 2.30.2