Game Development Community

engine.pause

by Dan Pascal · in Torque X 2D · 01/21/2010 (12:35 pm) · 4 replies

Is there anything like that?
At the moment I'm gathering all the objects in the scene and "un-activating" them,

im guessing the engine handles the input, so it would be impossible to unpause once paused anyway.....

any ideas to pause a game?

#1
01/21/2010 (12:45 pm)
I know that in TGE, there is a global timescale variable that, when set to zero, stops everything where it is.

$timescale = 0;// Would pause the game
$timescale = 1;// Would resume game

This worked for me when I placed these in the onWake and onSleep functions of my Pause gui. I can't use that anymore, though, since changing the timescale changes how fast/slow the server commands are sent, which I use in my gui.

I hope this helps.
#2
01/22/2010 (3:23 am)
we have that in TX as well, Game.Instance.Engine.GameTimeScale=1 is fulltilt, 0 = pause, and I guess you can do something in between for some effect maybe like bullet time.
#3
01/22/2010 (4:23 am)
Throwing your pause code inside the Update method of your Game class is good enough. You'll have to check the game state and check input manually(also do the gui manually if you are going to have a pause gui), but it works really well.
#4
01/23/2010 (4:21 pm)
hey awesome thanks
stuck it in the onregister within the component and works like a charm!!!