Game Development Community

Ending a mission and starting a new one

by Josiah Trumpower · in Torque Game Engine Advanced · 10/28/2009 (12:02 am) · 4 replies

I must be stupid or something, but I want to end a level and start a new one but don't know how to. If anyone can provide me with information on how to make the level end by triggers and obj collisions and starting the next one, please let me know.

#1
10/28/2009 (4:20 am)
you wanting to start a specific mission or just have a continuous cycling of missions when each mission is ended?
#2
10/29/2009 (4:19 pm)
A continuous cycling when trigger is "activated" proceed to next level (1, 2, 3 etc.)
#3
10/29/2009 (10:44 pm)
This isn't my code, but no use in reinventing the wheel. If it doesn't work when you drop it in, let me know and we'll figure it out.

// set the timer in function startGame (called by onMissionLoaded)
$Game::Schedule = schedule($Game::Duration * 1000, 0, "CycleGame" );

function cycleGame()
{
if (!$Game::Cycling) {
$Game::Cycling = true;
$Game::Schedule = schedule(0, 0, "onCycleExec");
}
}

function onCycleExec()
{
endGame();
$Game::Schedule = schedule($Game::EndGamePause * 1000, 0, "onCyclePauseEnd");
}

function onCyclePauseEnd()
{
$Game::Cycling = false;
echo("@@@@@@@@@@@ enter to onCyclePauseEnd ");
// Just cycle through the missions for now.
%search = $Server::MissionFileSpec;
for (%file = findFirstFile(%search); %file !$= ""; %file = findNextFile(%search)) {
if (%file $= $Server::MissionFile) {
// Get the next one, back to the first if there is no next.
%file = findNextFile(%search);
if (%file $= "")
%file = findFirstFile(%search);
break;
}
}
loadMission(%file);
echo("@@@@@@@@@@@ leave the onCyclePauseEnd ");
}
#4
10/30/2009 (1:59 am)
OK thanks for the help but I finally found a source that i got the code from. They are both different but i think they will probably work the same.