Advertisement
Tomas30022

Fireattack2 (Wave Script)

Dec 3rd, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. frame = 0
  2. variation = 0
  3. bullets = {}
  4. balls = {}
  5. function CreateBullet(x, y)
  6. local bullet = CreateProjectile("Tomas/Fireball 1", x, y)
  7. bullet.sprite.SetAnimation({"Tomas/Fireball 1", "Tomas/Fireball 1B"}, 1/5)
  8. bullet.sprite.rotation = 180
  9. table.insert(bullets, bullet)
  10. bullet.SetVar("spawnframe", 0)
  11. end
  12. function CreateBall(x, y)
  13. local bullet = CreateProjectile("Tomas/Fireball 1", x, y)
  14. bullet.sprite.SetAnimation({"Tomas/Fireball 1", "Tomas/Fireball 1B"}, 1/5)
  15. bullet.sprite.rotation = 180
  16. table.insert(balls, bullet)
  17. bullet.SetVar("spawnframe", 0)
  18. end
  19. function Update()
  20. frame = frame + 1
  21. if frame % 5 == 0 then
  22. local xPos = -Arena.width / 2
  23. local yPos = -Arena.width / 2 + 5
  24. CreateBullet(xPos, yPos)
  25. end
  26. if frame % 20 == 0 then
  27. local xPos = -Arena.width / 2
  28. local yPos = Arena.width / 2 + 50
  29. CreateBall(xPos, yPos)
  30. end
  31. for i = #bullets, 1, -1
  32. do
  33. currentBullet = bullets[i]
  34. currentBullet["spawnframe"] = currentBullet["spawnframe"] + 1
  35. if currentBullet["spawnframe"] <30 then
  36. currentBullet.Move(5, 1.1)
  37. elseif currentBullet["spawnframe"] <60 then
  38. currentBullet.Move(-5, 1.1)
  39. elseif currentBullet["spawnframe"] <90 then
  40. currentBullet.Move(5, 1.1)
  41. elseif currentBullet["spawnframe"] <120 then
  42. currentBullet.Move(-5, 1.1)
  43. end
  44. for i = #balls, 1, -1
  45. do
  46. currentBall = balls[i]
  47. currentBall["spawnframe"] = currentBall["spawnframe"] + 1
  48. if currentBall["spawnframe"] <30 then
  49. currentBall.Move(5, 1.1)
  50. elseif currentBall["spawnframe"] <60 then
  51. currentBall.Move(-5, 1.1)
  52. elseif currentBall["spawnframe"] <90 then
  53. currentBall.Move(5, 1.1)
  54. elseif currentBall["spawnframe"] <120 then
  55. currentBall.Move(-5, 1.1)
  56. end
  57. if currentBullet.y > 170 then
  58. currentBullet.Remove()
  59. table.remove(bullets, i)
  60. end
  61. if currentBall.y > 300 then
  62. currentBall.Remove()
  63. table.remove(balls, i)
  64. end
  65. end
  66. end
  67. end
  68.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement