25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

explosion.lua 660 B

3 년 전
123456789101112131415161718192021222324252627
  1. explosion = Class{}
  2. function explosion:init(x, y, v, color)
  3. self.color = color
  4. self.x = x
  5. self.y = y
  6. self.v = v
  7. self.range = 0
  8. self.killed = false
  9. print(self.i)
  10. end
  11. function explosion:update(dt)
  12. self.range = self.range + dt * 24
  13. if self.range * self.v > WINDOW_WIDTH * 2 then
  14. print("killing myself with range" .. self.range)
  15. self.killed = true
  16. end
  17. end
  18. function explosion:render()
  19. print("rendering myself" .. self.x .. " " .. self.y .. " " .. self.range .. " " .. self.v)
  20. love.graphics.setColor(unpack(self.color))
  21. love.graphics.circle("fill", self.x, self.y, self.range * self.v, 100)
  22. end