Well first let me point out what your method doesn't let you do;
You can't run any kind of additional mechanics during this sequence of delays that you have
EG you couldn't run gravity, or an AI, or a parallax/starfield engine, at the same time as this stuff.
So if you only ever want to make levels that are a sequence of events seperated by delays, your method works fine and is quite intuitive. However, if you want to progress beyond that, it's worth figuring out how to do it in a while GameRunning() loop.
You didn't include your entire level so I'm guessing large parts of it, but here goes:
function LevelSetup()
SetCameraZoom(2000)
SetCameraPosition(0,0)
if IsiOS() then
SelectionClear()
end
latch = {}
latch[0] = false
latch[1] = false
latch[2] = false
end
function IsiOS()
return false
-- i can't make it run without defining this function... it seems like IsiOS isn't recognised on my older PC version.
end
function CheckConditions()
-- presumably some code goes in here..
end
function LevelLogic()
while GameRunning() do -- Run this loop continuously
if GetGameTime() > 2 and latch[0] == false then
latch[0] = true
if IsiOS() then
SetLevelDim(true)
Message("-Hired Defence-~Find your lost brothers and sisters, don't forget what you've learnt~This is unknown territory", true, 1.0, "Top")
WaitMessage(true)
SetLevelDim(false)
else
SetVignetteAlpha(255)
MessageBox("-Hired Defence- Find your lost brothers and sisters, don't forget what you've learnt. This is unknown territory")
Pause()
WaitDialog()
Unpause()
SetVignetteAlpha(255)
end
end
if GetGameTime() > 4 and latch[1] == false then
latch[1] = true
if IsiOS() then
Message("There should be enough seedlings to plant 4 Defence Trees, and maybe more,~Search the Asteroid Belt for seedlings.", true, 1.0, "Top")
WaitMessage(true)
else
MessageBox("There should be enough seedlings to plant 4 Defence Trees, and maybe more. Search the Asteroid Belt for seedlings.")
Pause()
WaitDialog()
Unpause()
end
end
if GetEmpire(1).NumSeedlings < 42 or GetEmpire(1).NumTrees < 1 then
CheckConditions() -- No idea what this does but you included it, so I will too
end
if GetEmpire(1).NumSeedlings > 42 and latch[2] == false then
latch[2] = true
if IsiOS() then
Message("Now you have enough seedlings to create 4 Defence Trees~Find an Asteroid that supports planting.", true, 1.0, "Top")
else
MessageBox("Now you have enough seedlings to create 4 Defence Trees. Find an Asteroid that supports planting.")
end
end
coroutine.yield()
end
end
I still can't make IsiOS() work by the way.
I'll look for a way to fix that problem now..