34 lines
732 B
Lua
34 lines
732 B
Lua
Granade = {}
|
|
class('Granade').extends(NobleSprite)
|
|
|
|
function Granade:init(x, y)
|
|
Granade.super.init(self)
|
|
|
|
self.initialRadius = 10
|
|
self.currentRadius = self.initialRadius
|
|
self.shrinkRate = 0.2
|
|
|
|
self.isActive = true
|
|
|
|
self:moveTo(x, y)
|
|
|
|
print("Granade init")
|
|
print(self.x, self.y)
|
|
end
|
|
|
|
function Granade:update()
|
|
if self.isActive then
|
|
self.currentRadius = self.currentRadius - self.shrinkRate
|
|
|
|
if self.currentRadius <= 0 then
|
|
print("Granade deactivated")
|
|
self.isActive = false
|
|
self:remove()
|
|
end
|
|
end
|
|
self:draw()
|
|
end
|
|
|
|
function Granade:draw()
|
|
playdate.graphics.fillCircleAtPoint(self.x, self.y, self.currentRadius)
|
|
end |