Game Development Community

Need Help - Pausing game doesnt pause schedules

by Nicolai Dutka · in Torque Game Builder · 03/29/2008 (9:49 pm) · 7 replies

$timescale=0; //pauses the game all schedules
$timescale=1; //resumes the game and all schedules

#1
03/29/2008 (11:51 pm)
What?
#2
04/28/2008 (3:27 pm)
I think I have the same problem- when I use the "setScenePause()" method in the t2dsceneGraph class, it doesn't pause my schedules.
For example, I have a Mario that updates his velocity while falling every second by scheduling an "updateVelocity()" method, which makes him fall a little bit faster every second that passes. When the scene is paused, he keeps calling "updateVelocity()" but the changes in his velocity aren't visible until you unpause, at which point he flies down at a really high speed because he was incrementing his velocity the whole time.
How can I pause schedules so that they stop running until I unpause?
#3
04/28/2008 (3:38 pm)
Try both! It worked for me:

Pause:
%level.setScenePause(1);
$timeScale=0;

Un-pause:
%level.setScenePause(0);
$timeScale=1;
#4
04/28/2008 (6:30 pm)
Thanks a ton for the $timeScale tip Nicolai- it works a lot better than the setScenePause() method. What is that variable anyways? And how do I find that kind of information? I've been reading the documentation thing that came with the download, but a lot of the higher level stuff, like the hierarchy of a lot of the objects, seem to be incomplete.
#5
04/28/2008 (6:53 pm)
$timeScale is a variable that has been around ... well since forever, so a lot of people familiar with TGE are aware of it. It probably isn't mentioned anywhere in TGB documentation.
#6
08/25/2011 (8:47 pm)
Oh my god that is useful. I realize this thread is old, but seriously, $timescale: it makes pausing a snap.
#7
08/26/2011 (3:11 pm)
I experimented once with $timescale, and if I recall, I was always able to do "one more" mouse operation after pause. For instance, I could place one more game unit on the field or collect one more (paused) jewel. It was very weird. After that, it worked as expected.