Clean up dead sprites properly.
This commit is contained in:
parent
9102397c77
commit
5019be454c
4 changed files with 30 additions and 13 deletions
|
@ -30,7 +30,7 @@ function Entity:damage(amount)
|
|||
self.health = math.max(self.health - (amount - self.armor), 0)
|
||||
|
||||
if self.health == 0 then
|
||||
self:remove()
|
||||
self:delete()
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -38,3 +38,8 @@ function Entity:update()
|
|||
local collisions = select(3, self:moveWithCollisions(self.x + self.vector.x, self.y + self.vector.y))
|
||||
return collisions
|
||||
end
|
||||
|
||||
-- override this if you create timers
|
||||
function Entity:delete()
|
||||
self:remove()
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue