I'm pretty new and have looked up my question to no avail, What I have are objects like balloons that float from bottom of the screen to the top, my problem is the spawnBallons function is only called once so only one object appears I want to call the function multiple times to spawn multiple objects and increase the number of objects spawned every 20 seconds?
function spwanBalloons()
local allBalloons = {"green_balloon2.png", "red_balloon.png"}
ballons = display.newImage(allBalloons[math.random(#allBalloons)])
ballons.x = math.random(display.contentWidth)
ballons.y = display.contentHeight + 60
transition.to( ballons, { time=math.random(3500-speedBump, 4500-speedBump), y=-100} )
speedBump = speedBump + 15
end
function startGame()
scoreText = display.newText( "Score: 0", 0, 0, "Helvetica", 22 )
scoreText.x = centerX
scoreText.y = display.screenOriginY + 10
spwanBalloons()
end
I tried this timer.performWithDelay( 500, spwanBalloons, 50 ) But All it does is spawn 50 objects over a half a second, I want to spawn a random amount of object until I tell it to stop?