From: Lukas Krickl Date: Sun, 22 Jun 2025 05:47:19 +0000 (+0200) Subject: unit: the player unit can now move in multiple directions on the same X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=ba3b7d077f981511fa47799929d449134d461c21;p=gbrg%2F.git unit: the player unit can now move in multiple directions on the same frame --- 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