From 066026c1127f3470e8ce3b6478b06c4341a7e0a0 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Mon, 18 Aug 2025 05:28:22 +0200 Subject: [PATCH] action: Added tile offset to attack action --- src/action.s | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) 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 -- 2.30.2