gameOver.lua 846 B

1234567891011121314151617181920212223242526272829
  1. local GameOver = class()
  2. function GameOver:init()
  3. self.alpha = 0
  4. end
  5. function GameOver:update()
  6. if ctx.map.mods.scoring and ctx.map.mods.scoring.winner then
  7. self.alpha = math.lerp(self.alpha, 1, math.min(5 * tickRate, 1))
  8. else
  9. self.alpha = 0
  10. end
  11. end
  12. function GameOver:draw()
  13. if not ctx.map.mods.scoring or not ctx.map.mods.scoring.winner then return end
  14. local u, v = ctx.hud.u, ctx.hud.v
  15. local p = ctx.players:get(ctx.id)
  16. local g = love.graphics
  17. local str = p.team == ctx.map.mods.scoring.winner and 'Victory!' or 'Defeat!'
  18. g.setFont('BebasNeue', v * .1)
  19. g.setColor(0, 0, 0, 100)
  20. g.printCenter(str, u * .5 + 2, v * .5 + 2)
  21. g.setColor(p.team == ctx.map.mods.scoring.winner and (p.team == purple and {190, 160, 200} or {240, 160, 140}) or {150, 0, 0})
  22. g.printCenter(str, u * .5, v * .5)
  23. end
  24. return GameOver