Code: Select all
onAttack = function(self)
local dx,dy = getForward(self.facing)
local x,y = self.x + dx, self.y + dy
spawn("shockburst", self.level, self.x + dx, self.y + dy, self.facing)Code: Select all
onAttack = function(self)
local dx,dy = getForward(self.facing)
local x,y = self.x + dx, self.y + dy
spawn("shockburst", self.level, self.x + dx, self.y + dy, self.facing)Code: Select all
cloneObject {
name = "sparky_slime",
baseObject = "green_slime",
onAttack = function(monster, attack_name)
local attackFacing = monster.facing; -- The default facing for normal attacks
if ( attack_name == "attackLeft" ) then attackFacing = (attackFacing - 1) % 4;
elseif ( attack_name == "attackRight" ) then attackFacing = (attackFacing + 1) % 4;
elseif ( attack_name == "attackBack" ) then attackFacing = (attackFacing + 2) % 4;
end
local dx,dy = getForward(attackFacing);
spawn("shockburst", monster.level, monster.x + dx, monster.y + dy, attackFacing);
end
}
Happens to me. Every. Freaking. Time.I fell back to curly-braces as I was programming in a different language