33 lines
1,008 B
Lua
33 lines
1,008 B
Lua
---@class ProjectileDeathEffect:GameObject
|
|
local ProjectileDeathEffect = GameObject:extend()
|
|
|
|
function ProjectileDeathEffect:new(area, x, y, opts)
|
|
ProjectileDeathEffect.super.new(self, area, x, y, opts)
|
|
-- width
|
|
self.w = opts.w or 12
|
|
self.first = true
|
|
self.timer:after(0.1, function()
|
|
self.first = false
|
|
self.second = true
|
|
self.timer:after(0.15, function()
|
|
self.second = false
|
|
self:kill()
|
|
end)
|
|
end)
|
|
end
|
|
|
|
---Updates ProjectileDeathEffect
|
|
---@param dt number delta time
|
|
function ProjectileDeathEffect:update(dt)
|
|
ProjectileDeathEffect.super.update(self, dt)
|
|
end
|
|
|
|
---Draws ProjectileDeathEffect
|
|
function ProjectileDeathEffect:draw()
|
|
ProjectileDeathEffect.super.draw(self)
|
|
if self.first then love.graphics.setColor(COLORS.default)
|
|
elseif self.second then love.graphics.setColor(COLORS.hp) end
|
|
love.graphics.rectangle('fill', self.x - self.w/2, self.y - self.w/2, self.w, self.w)
|
|
end
|
|
|
|
return ProjectileDeathEffect
|