2
0

skull.lua 691 B

12345678910111213141516171819202122232425262728
  1. local Skull = {}
  2. Skull.name = 'Skull'
  3. Skull.code = 'skull'
  4. Skull.activate = function(self)
  5. self.health = 5
  6. self.scale = 1
  7. self.alpha = 1
  8. self.image = data.media.graphics.effects.skull
  9. self.depth = -10
  10. ctx.view:register(self)
  11. end
  12. Skull.update = function(self)
  13. self.health = self.health - tickRate
  14. if self.health <= 0 then return true end
  15. self.scale = self.scale - .05 * tickRate
  16. self.alpha = self.alpha - .2 * tickRate
  17. end
  18. Skull.draw = function(self)
  19. love.graphics.setColor(255, 255, 255, self.alpha * 255)
  20. love.graphics.draw(self.image, self.x, self.y, self.angle, self.scale, self.scale, self.image:getWidth() / 2, self.image:getHeight() / 2)
  21. end
  22. return Skull