You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1023 B

  1. explosion = Class{}
  2. function explosion:init(x, y, v, color, type)
  3. self.color = color
  4. self.type = 0
  5. self.x = x
  6. self.y = y
  7. self.v = v
  8. self.range = 0
  9. self.killed = false
  10. if type ~= nil then
  11. self.type = type
  12. end
  13. --print(self.i)
  14. end
  15. function explosion:update(dt)
  16. self.range = self.range + dt * 24
  17. local maxRange = WINDOW_WIDTH*2
  18. if self.type >= 1 then
  19. maxRange = WINDOW_WIDTH*6
  20. end
  21. if self.range * self.v > maxRange then
  22. --print("killing myself with range" .. self.range)
  23. self.killed = true
  24. end
  25. end
  26. function explosion:render(toggle)
  27. --print("rendering myself" .. self.x .. " " .. self.y .. " " .. self.range .. " " .. self.v)
  28. love.graphics.setColor(unpack(self.color))
  29. if toggle == "special" then
  30. love.graphics.setColor(1,1,1,0.7/(self.range/6))
  31. -- print(self.range)
  32. end
  33. love.graphics.circle("fill", self.x, self.y, self.range * self.v, 100)
  34. love.graphics.setColor(1,1,1,1)
  35. end