But I noticed when it does a turn attack it will keep casting it in front of it, and not where is actually attacking.
So I've figured out how can this be solved. It's a bit tricky, and not immediate, and someone might find it useful.
The code is:
Code: Select all
onAttack = function(self, attack)
local dx, dy = getForward(self.facing)
if attack == "attack" then
spawn("fireburst", self.level, self.x+dx, self.y+dy, 0)
elseif attack == "turnAttackLeft" then
spawn("fireburst", self.level, self.x+dy, self.y-dx, 0)
elseif attack == "turnAttackRight" then
spawn("fireburst", self.level, self.x-dy, self.y+dx, 0)
end
end,