wave.lua 623 B

123456789101112131415161718192021222324
  1. local g = love.graphics
  2. local Wave = class()
  3. function Wave:init()
  4. self:resize()
  5. self.strength = {0, 0}
  6. end
  7. function Wave:update()
  8. local p = ctx.player
  9. local ratio = love.graphics.getWidth() / love.graphics.getHeight()
  10. self.strength[1] = lume.lerp(self.strength[1], p.dead and .0025 or 0, 3 * ls.tickrate)
  11. self.strength[2] = lume.lerp(self.strength[2], p.dead and (.0025 * ratio) or 0, 3 * ls.tickrate)
  12. self.shader:send('time', tick * .04)
  13. self.shader:send('strength', self.strength)
  14. self.active = self.strength[1] > .0001
  15. end
  16. function Wave:resize()
  17. self.shader = data.media.shaders.wave
  18. end
  19. return Wave