Clean up dead sprites properly.

This commit is contained in:
Anna Rose Wiggins 2023-09-30 18:23:42 -04:00
parent 9102397c77
commit 5019be454c
4 changed files with 30 additions and 13 deletions

View file

@ -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