bomber
This commit is contained in:
34
source/scripts/bomber/granade.lua
Normal file
34
source/scripts/bomber/granade.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
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
|
||||
Reference in New Issue
Block a user