Advertisement
Tomas30022

Fireattack1 (Wave Script)

Dec 2nd, 2020 (edited)
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. frame = 0
  2. bullets = {}
  3.  
  4. function CreateBullet(x, y)
  5. local bullet = CreateProjectile("Tomas/Fireball 1", x, y)
  6. table.insert(bullets, bullet)
  7. end
  8.  
  9. function Update()
  10. if frame % 30 == 0 then
  11. for i = 0, 4, 1
  12. do
  13. local xPos = -Arena.width / 2 + i * Arena.width / 4
  14. local yPos = -Arena.height / 2 - 50
  15. CreateBullet(xPos, yPos)
  16. elseif frame % 60 == 0 then
  17. for i = 0, 4, 1
  18. do
  19. local xPos = -Arena.width / 2 + 1 * Arena.width / 4 + 20
  20. local yPos = -Arena.height / 2 - 50
  21. CreateBullet(xPos, yPos)
  22. end
  23. end
  24. for i = #bullets, 1, -1
  25. do
  26. currentBullet = bullets[i]
  27.  
  28. currentBullet.Move(0, 2)
  29.  
  30. if currentBullet.y > 170 then
  31. currentBullet.Remove()
  32. table.remove(bullets, i)
  33. end
  34. end
  35. frame = frame + 1
  36. end
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement