blood.lua 712 B

12345678910111213141516171819202122232425
  1. local Blood = {}
  2. Blood.name = 'Blood'
  3. Blood.code = 'blood'
  4. Blood.activate = function(self)
  5. self.alpha = .6 + love.math.random() * .4
  6. self.scale = .2 + love.math.random() * .2
  7. self.angle = love.math.random() * math.pi * 2
  8. self.image = data.media.graphics.effects['blood' .. love.math.random(4)]
  9. self.depth = -1
  10. ctx.view:register(self)
  11. end
  12. Blood.update = function(self)
  13. self.alpha = self.alpha - tickRate * .1
  14. if self.alpha <= 0 then return true end
  15. end
  16. Blood.draw = function(self)
  17. love.graphics.setColor(200, 0, 0, self.alpha * 255)
  18. love.graphics.draw(self.image, self.x, self.y, self.angle, self.scale, self.scale, self.image:getWidth() / 2, self.image:getHeight() / 2)
  19. end
  20. return Blood