Advertisement
Tomas30022

Fireattack2 (Original Wave Script)

Dec 3rd, 2020
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. frame = 0
  2. variation = 0
  3. bullets = {}
  4. bullets2 = {}
  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 CreateBullet2(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(bullets2, bullet)
  17. bullet.SetVar("spawnframe2", 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 + variation
  28. local yPos = Arena.height / 2 + 50
  29. CreateBullet2(xPos, yPos)
  30. variation = variation + 30
  31. end
  32. for i = #bullets, 1, -1
  33. do
  34. currentBullet = bullets[i]
  35. currentBullet["spawnframe"] = currentBullet["spawnframe"] + 1
  36. if currentBullet["spawnframe"] <30 then
  37. currentBullet.Move(5, 1.1)
  38. elseif currentBullet["spawnframe"] <60 then
  39. currentBullet.Move(-5, 1.1)
  40. elseif currentBullet["spawnframe"] <90 then
  41. currentBullet.Move(5, 1.1)
  42. elseif currentBullet["spawnframe"] <120 then
  43. currentBullet.Move(-5, 1.1)
  44. end
  45. if currentBullet.y > 170 then
  46. currentBullet.Remove()
  47. table.remove(bullets, i)
  48. end
  49. for i = #bullets2, 1, -1
  50. do
  51. currentBullet2 = bullets2[i]
  52. currentBullet2["spawnframe2"] = currentBullet2["spawnframe2"] + 1
  53. if currentBullet2["spawnframe2"] >40 then
  54. currentBullet2.Move(1, 0)
  55. end
  56. if currentBullet2.y < -100 then
  57. currentBullet2.Remove()
  58. table.remove(bullets2, i)
  59. end
  60. end
  61. end
  62. end
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement