Game Over and coming back to Main Menu
by Dirk Hoffmann · in Torque Game Builder · 06/10/2006 (11:46 am) · 1 replies
Hello,
I have some routines for realizing a GameOver and coming back to the main menu allowing then to restart a new game. Unfortunately once i reach the menu there is a delay of at least 10 seconds, during which the mouse pointer isn't controllable. Someone there who knows why or what to fix to avoid this delay?
Thanks a lot
Dirk
The core for this is build by following three functions:
function displayGameOver()
{
$GameOverImage.setPosition("0 0");
$wells.setAutoRotation(20);
schedule(2000,0,"Neustart");
}
function Neustart()
{
endGame();
canvas.setContent(MainMenuGui);
canvas.setCursor(DefaultCursor);
}
function endGame()
{
//sceneWindow2D.endLevel();
for ( %n = 0; %n < $activeStuff1.getCount(); %n++ )
{
%obj = $activeStuff1.getObject(%n);
%obj.safeDelete();
}
if (isObject($player))
$player.delete();
if (isObject(t2dScene))
t2dScene.delete();
}
I have some routines for realizing a GameOver and coming back to the main menu allowing then to restart a new game. Unfortunately once i reach the menu there is a delay of at least 10 seconds, during which the mouse pointer isn't controllable. Someone there who knows why or what to fix to avoid this delay?
Thanks a lot
Dirk
The core for this is build by following three functions:
function displayGameOver()
{
$GameOverImage.setPosition("0 0");
$wells.setAutoRotation(20);
schedule(2000,0,"Neustart");
}
function Neustart()
{
endGame();
canvas.setContent(MainMenuGui);
canvas.setCursor(DefaultCursor);
}
function endGame()
{
//sceneWindow2D.endLevel();
for ( %n = 0; %n < $activeStuff1.getCount(); %n++ )
{
%obj = $activeStuff1.getObject(%n);
%obj.safeDelete();
}
if (isObject($player))
$player.delete();
if (isObject(t2dScene))
t2dScene.delete();
}
Torque 3D Owner Chris Jorgensen
Cascadia Games LLC