Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- frame = 0
- variation = 0
- bullets = {}
- balls = {}
- function CreateBullet(x, y)
- local bullet = CreateProjectile("Tomas/Fireball 1", x, y)
- bullet.sprite.SetAnimation({"Tomas/Fireball 1", "Tomas/Fireball 1B"}, 1/5)
- bullet.sprite.rotation = 180
- table.insert(bullets, bullet)
- bullet.SetVar("spawnframe", 0)
- end
- function CreateBall(x, y)
- local bullet = CreateProjectile("Tomas/Fireball 1", x, y)
- bullet.sprite.SetAnimation({"Tomas/Fireball 1", "Tomas/Fireball 1B"}, 1/5)
- bullet.sprite.rotation = 180
- table.insert(balls, bullet)
- bullet.SetVar("spawnframe", 0)
- end
- function Update()
- frame = frame + 1
- if frame % 5 == 0 then
- local xPos = -Arena.width / 2
- local yPos = -Arena.width / 2 + 5
- CreateBullet(xPos, yPos)
- end
- if frame % 20 == 0 then
- local xPos = -Arena.width / 2
- local yPos = Arena.width / 2 + 50
- CreateBall(xPos, yPos)
- end
- for i = #bullets, 1, -1
- do
- currentBullet = bullets[i]
- currentBullet["spawnframe"] = currentBullet["spawnframe"] + 1
- if currentBullet["spawnframe"] <30 then
- currentBullet.Move(5, 1.1)
- elseif currentBullet["spawnframe"] <60 then
- currentBullet.Move(-5, 1.1)
- elseif currentBullet["spawnframe"] <90 then
- currentBullet.Move(5, 1.1)
- elseif currentBullet["spawnframe"] <120 then
- currentBullet.Move(-5, 1.1)
- end
- for i = #balls, 1, -1
- do
- currentBall = balls[i]
- currentBall["spawnframe"] = currentBall["spawnframe"] + 1
- if currentBall["spawnframe"] <30 then
- currentBall.Move(5, 1.1)
- elseif currentBall["spawnframe"] <60 then
- currentBall.Move(-5, 1.1)
- elseif currentBall["spawnframe"] <90 then
- currentBall.Move(5, 1.1)
- elseif currentBall["spawnframe"] <120 then
- currentBall.Move(-5, 1.1)
- end
- if currentBullet.y > 170 then
- currentBullet.Remove()
- table.remove(bullets, i)
- end
- if currentBall.y > 300 then
- currentBall.Remove()
- table.remove(balls, i)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement