A pong clone, but with a twist!
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

97 lignes
3.1 KiB

  1. local player1anim = false
  2. local player2anim = false
  3. local player1animend = false
  4. local player2animaend = false
  5. local effectRange = {[0] = 0,[1] = 0}
  6. local diseffectRange = {[0] = 0,[1] = 0}
  7. function superanimator(type, param)
  8. if type == 'tensehit' then
  9. if param == 1 then
  10. --print("Animation called!")
  11. player1anim = true
  12. end
  13. if param == 2 then
  14. --print("Animation called!")
  15. player2anim = true
  16. end
  17. end
  18. end
  19. function staticanimatorcounter(dt)
  20. if (gameState == 'animation') then
  21. time_1 = time_1 + dt
  22. light = 255 - time_1 * 85
  23. if (light < 0) then
  24. time_1 = 0
  25. light = 0
  26. gameState = 'start'
  27. end
  28. end
  29. if areanuclear == 1 then
  30. if nuclearanimation > 0 then
  31. gameState = 'nuclearExplosion'
  32. nuclearanimation = nuclearanimation - dt
  33. explosionRange = explosionRange + dt*24
  34. elseif (gameState ~= 'play') then
  35. gameState = 'play'
  36. explosionRange = 0
  37. end
  38. end
  39. if gameState == "done" then
  40. if explosionRange < 40 then
  41. nuclearanimation = nuclearanimation - dt
  42. explosionRange = explosionRange + dt*24
  43. end
  44. end
  45. if (player1anim) then
  46. --print("Effect range: " .. effectRange[0])
  47. effectRange[0] = effectRange[0] + dt*24
  48. if effectRange[0] > 7500/ballSpeed then
  49. player1animend = true
  50. end
  51. end
  52. if player1animend then
  53. --print("DISEffect range: " .. diseffectRange[0])
  54. diseffectRange[0] = diseffectRange[0] + dt*24
  55. if diseffectRange[0] > 50 then
  56. effectRange[0] = 0
  57. diseffectRange[0] = 0
  58. player1anim = false
  59. player1animend = false
  60. end
  61. end
  62. if (player2anim) then
  63. --print("Effect range: " .. effectRange[1])
  64. effectRange[1] = effectRange[1] + dt*24
  65. if effectRange[1] > 7500/ballSpeed then
  66. player2animend = true
  67. end
  68. end
  69. if player2animend then
  70. --print("DISEffect range: " .. diseffectRange[1])
  71. diseffectRange[1] = diseffectRange[1] + dt*24
  72. if diseffectRange[1] > 50 then
  73. effectRange[1] = 0
  74. diseffectRange[1] = 0
  75. player2anim = false
  76. player2animend = false
  77. end
  78. end
  79. end
  80. function staticanimator()
  81. if player1anim then
  82. love.graphics.setColor(140/255,70/255,70/255,1)
  83. love.graphics.circle("fill", player1.x, player1.y , effectRange[0]*100, 100)
  84. end
  85. if player1animend then
  86. love.graphics.setColor(40/255,40/255,40/255,1)
  87. love.graphics.circle("fill", player1.x, player1.y , diseffectRange[0]*100, 100)
  88. end
  89. if player2anim then
  90. love.graphics.setColor(70/255,70/255,140/255,1)
  91. love.graphics.circle("fill", player2.x, player2.y , effectRange[1]*100, 100)
  92. end
  93. if player2animend then
  94. love.graphics.setColor(40/255,40/255,40/255,1)
  95. love.graphics.circle("fill", player2.x, player2.y , diseffectRange[1]*100, 100)
  96. end
  97. end