A pong clone, but with a twist!
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

animator.lua 2.9 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 (player1anim) then
  40. print("Effect range: " .. effectRange[0])
  41. effectRange[0] = effectRange[0] + dt*24
  42. if effectRange[0] > 7500/ballSpeed then
  43. player1animend = true
  44. end
  45. end
  46. if player1animend then
  47. print("DISEffect range: " .. diseffectRange[0])
  48. diseffectRange[0] = diseffectRange[0] + dt*24
  49. if diseffectRange[0] > 50 then
  50. effectRange[0] = 0
  51. diseffectRange[0] = 0
  52. player1anim = false
  53. player1animend = false
  54. end
  55. end
  56. if (player2anim) then
  57. print("Effect range: " .. effectRange[1])
  58. effectRange[1] = effectRange[1] + dt*24
  59. if effectRange[1] > 7500/ballSpeed then
  60. player2animend = true
  61. end
  62. end
  63. if player2animend then
  64. print("DISEffect range: " .. diseffectRange[1])
  65. diseffectRange[1] = diseffectRange[1] + dt*24
  66. if diseffectRange[1] > 50 then
  67. effectRange[1] = 0
  68. diseffectRange[1] = 0
  69. player2anim = false
  70. player2animend = false
  71. end
  72. end
  73. end
  74. function staticanimator()
  75. if player1anim then
  76. love.graphics.setColor(140/255,70/255,70/255,1)
  77. love.graphics.circle("fill", player1.x, player1.y , effectRange[0]*100, 100)
  78. end
  79. if player1animend then
  80. love.graphics.setColor(40/255,40/255,40/255,1)
  81. love.graphics.circle("fill", player1.x, player1.y , diseffectRange[0]*100, 100)
  82. end
  83. if player2anim then
  84. love.graphics.setColor(70/255,70/255,140/255,1)
  85. love.graphics.circle("fill", player2.x, player2.y , effectRange[1]*100, 100)
  86. end
  87. if player2animend then
  88. love.graphics.setColor(40/255,40/255,40/255,1)
  89. love.graphics.circle("fill", player2.x, player2.y , diseffectRange[1]*100, 100)
  90. end
  91. end