There are quite a few ways you could do it. The main thing would be keeping track of how much total time has passed and how much time has passed since your last spawning. Below code probably won’t work due to syntax errors but at least the logic should be sound.
[lua]local iTotalTimer = 0
local iTimeSinceSpawn = 0
– timer goes off every second just for easy maths
spawnTimer = timer.performWithDelay(1000, spawnTimerListener, 0)
function spawnTimerListener()
–increment timers. god I miss incrementing by int++
iTotalTimer = iTotalTimer + 1;
iTimeSinceSpawn = iTimeSinceSpawn + 1
–check the total timer and spawntimer. going to go with a 10 second, 5second then 1 second spawn timer. spawnEnemy would be whatever function creates your new object.
if iTotalTimer < 60 and iTimeSinceSpawn >= 10 then
spawnEnemy()
–really, iTimeSinceSpawn would be better in your spawnEnemy() function but i don’t have one of those so there it is.
iTimeSinceSpawn = 0
elseif iTotalTimer >=60 and iTotalTimer < 90 and iTimeSinceSpawn >=5 then
spawnEnemy()
itimeSinceSpawn = 0
elseif iTotalTimer >= 90 and iTimeSinceSpawn >= 1 then
spawnEnemy()
itimeSinceSpawn = 0
end[/lua] [import]uid: 147305 topic_id: 30610 reply_id: 122646[/import]