Spawning Balloons Script

A while ago i was using Corona and I was setting up a Balloons Game, but since my old computers hard drive went dead I lost those script, I remember I was using the 8 minute tutorials on youtube that AnscaMobile Provided but I dont exactly remember everything that i had involved with it, mainly because I cant remember the name of how to call it.

Now basically this is my code that i made earlier today based off of the tutorial

[lua]system.activate(“multitouch”)

local physics = require(“physics”)
physics.start()

physics.setGravity(0, 9.8)

local background = display.newImage(“Graphics/sky.png”)

local balloon = display.newImage(“Graphics/balloon1.png”)
balloon.x = display.contentWidth/2
physics.addBody(balloon)

local score = 0;
local text = display.newText(“You Popped Balloons!”, 50, 50, nil, 26)
text:setTextColor(0,0,0)

transition.to(text, {time = 2000, alpha = 0, x = 300, y = 400})

display.setStatusBar( display.HiddenStatusBar )[/lua]

Now when it comes to the balloon spawning, I was going to have the gravity set to negative and the balloon spawning underneath the screen, and I wanted it to spawn multiple balloons and not stop spawning them until lets say you popped 100. I remember there was a way where I could just position where it would spawn and call out the image i wanted it to spawn and once I launched it there would be multiple of the flying up the screen. I cant seem to remember what line of code did this so all i really want is for someone to tell me that.

All Help is appreciated
EDIT

And btw, If you know how please tell me how i can set this up

When they touch a balloon it adds 1 to score and than the text goes to the middle of the screen

As seen in the code i have this code

[lua]local score = 0;
local text = display.newText(“You Popped Balloons!”, 50, 50, nil, 26)
text:setTextColor(0,0,0)

transition.to(text, {time = 2000, alpha = 0, x = 300, y = 400})[/lua]
Now for the
[lua]local text = display.newText(“You Popped Balloons!”, 50, 50, nil, 26)[/lua]
I tried doing this
[lua]local text = display.newText(“You Popped “+score+” Balloons!”, 50, 50, nil, 26)[/lua]
But that didnt work on making it display the current score atleast, any ideas on how to make that work? And on how to make it add to the variable score?

Thanks in Advanced [import]uid: 81383 topic_id: 18566 reply_id: 318566[/import]

I found it in one of there videos

For those who find this the correct code would be this

[lua]local function spawnBalloon()
local balloon = display.newImage(“Graphics/balloon1.png”)
balloon.x = display.contentWidth/2
balloon.y = display.contentHeight + 150
physics.addBody(balloon)

end

timer.performWithDelay( 500, spawnBalloon, 100)[/lua] [import]uid: 81383 topic_id: 18566 reply_id: 71303[/import]

Well done for solving it and thank you for posting your solution for others!

Peach :slight_smile:

PS - you may want to consider inserting your balloons into a table. [import]uid: 52491 topic_id: 18566 reply_id: 71351[/import]