From: Lukas Krickl Date: Mon, 18 Aug 2025 03:28:22 +0000 (+0200) Subject: action: Added tile offset to attack action X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=066026c1127f3470e8ce3b6478b06c4341a7e0a0;p=gbrg%2F.git action: Added tile offset to attack action --- diff --git a/src/action.s b/src/action.s index 3b77df7..5634416 100644 --- a/src/action.s +++ b/src/action.s @@ -131,11 +131,32 @@ unit_action_attack: push de ; get location call unit_get_pos + + ld hl, act_rt_action_dat1 + add hl, de ; hl = dat1 - ld de, act_rt_action_dat1 - add hl, de - ; TODO determine where to draw animation + ; determine where to draw animation ld a, [hl] ; a = direction pressed + cp a, DIRUP + jr nz, @not_up REL + dec b ; y-- +@not_up: + + cp a, DIRDOWN + jr nz, @not_down REL + inc b ; y++ +@not_down: + + cp a, DIRLEFT + jr nz, @not_left REL + dec c ; x-- +@not_left: + + cp a, DIRRIGHT + jr nz, @not_right REL + inc c ; x++ +@not_right: + ; draw a slash animation at that location push bc