staticgrenade.lua 579 B

1234567891011121314151617181920212223242526
  1. local StaticGrenade = {}
  2. StaticGrenade.name = 'StaticGrenade'
  3. StaticGrenade.code = 'staticgrenade'
  4. StaticGrenade.activate = function(self)
  5. self.health = .3
  6. self.alpha = 1
  7. self.depth = -9
  8. ctx.view:register(self)
  9. end
  10. StaticGrenade.update = function(self)
  11. self.health = self.health - tickRate
  12. if self.health <= 0 then return true end
  13. self.alpha = self.alpha - (1 / .3) * tickRate
  14. end
  15. StaticGrenade.draw = function(self)
  16. love.graphics.setColor(0, 255, 255, self.alpha * 255)
  17. love.graphics.circle('fill', self.x, self.y, self.radius)
  18. end
  19. return StaticGrenade