This is the basic foundation I begin my apps with. Hope it helps.
global g_GameState as integer
g_GameState = 1
disable escapekey
sync on
sync rate 60
backdrop on
color backdrop 0
autocam off
do
select g_GameState
case 1:
Intro()
endcase
case 2:
PlayGame()
endcase
case default:
exit
endcase
endselect
sync
loop
end
function Intro()
` When intro finished set g_GameState = 2
g_GameState = 2
endfunction
function PlayGame()
` If escapekey pressed set g_GameState = 0
if (escapekey())
g_GameState = 0
endif
center text screen width()/2, 64, "Game Playing."
endfunction