plasmacannon.lua 572 B

123456789101112131415161718192021222324252627
  1. local PlasmaCannon = {}
  2. PlasmaCannon.name = 'Plasma Cannon'
  3. PlasmaCannon.code = 'plasmacannon'
  4. PlasmaCannon.activate = function(self)
  5. self.health = .3
  6. self.alpha = 1
  7. self.depth = -9
  8. ctx.view:register(self)
  9. end
  10. PlasmaCannon.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. PlasmaCannon.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 PlasmaCannon