Harry,
If I understand your question correctly, this might work; or at least give you some starting point. Of course the spawn times I use here you should change to whatever times you want.
try this:
Add these 3 lines to top of the code:
local spawnTmr local spawnTime = 5000 local difficultyLevels = 4
Keep rest of the code as it is except the last line. Replace the last line with this :
local function increaseDifficulty() if spawnTmr ~= nil then timer.cancel(spawnTmr) spawnTmr = nil end spawnTime = spawnTime - 1000 -- just to be safe, set this to whatever spawn rate would be the -- fastest, so game never spawns to fast if spawnTime \< 1000 then spawnTime = 1000 end -- spawn at this rate until this timer is canceled spawnTmr = timer.performWithDelay(spawnTime, spawnEnemy, 0) end -- this timer loops only till spawning at most difficult speed is reached local difficultyTmr = timer.performWithDelay(15000, increaseDifficulty, difficultyLevels)
-
First series of spawns will be at 4 second intervals
-
15 seconds later, the spawns will be at 3 second intervals
-
15 seconds after that, at 2 second intervals
-
will never be faster then 1 second intervals
-
once at 1 second intervals, the spawning will continue to spawn till you call to cancel the spawnTmr
-
difficultyTmr should only loop till it gets to the fastest speed.
-
if all balloons are spawned/destroyed or wave is over… cancel both timers.
hope that helps.