trying to make a slash
so I'm currently working on an attack and want to make it so that even when I'm moving I am slashing the sword in any key I'm holding in and should rotate in that key because I'm not making a sprite for each direction, here's my attack code:
--attack
--attack variables
atck_strength = 5
atck_dur = 4
is_atck = false
atck_swing_anim_timer = 0
atck_delay = 2
function attack_init()
atckposx = 63
atckposy = 63
end
function attack_update()
if btnp(🅾️) then
is_atck = true
atck_swing_anim_timer = atck_dur
end
if atck_swing_anim_timer > 0 then
atck_swing_anim_timer -= 1
else
is_atck = false
end
end
function attack_draw()
if is_atck then
spr(001, atckposx, atckposy)
end
end