Game Development Community

Pausing the time?

by AzraelK · in Torque Game Builder · 10/31/2006 (9:38 am) · 3 replies

Im not sure if this goes here or in Torque Script but ok, I'll try here

Im having some events that happen at a certain time in my game, bridges go up and down, enemies spawn etc. problem is, when you pause the game with scene2d.pause the time will still continue, so when you return from the pause, all events will be out of synch.

Is there a way to pause the TIME in a scene inside the game?

#1
10/31/2006 (12:45 pm)
Try

$TimeScale = 0;

This should stop all schedules from firing. I'm not sure if it will have any other side effects with regards to how TGB's simulation works though.
#2
10/31/2006 (2:27 pm)
That sounds great! thanks, but Im looking for a way to stop certain timers in the scene, since that would stop the animation in the pause window.
#3
10/31/2006 (3:58 pm)
I finally fixed this, it was pretty simple, all you have to do is to check weither your scene is paused or not, if it is then you have to reschedule your events to another time. (1 sec later or so) you can set a global variable to hold this value or use $player.scenegraph.getScenePause() to see if the scene is paused or not. Works like a charm!

Thanks for the timescale value though. It can be used to completely pause the overall game. Even fadeouts are paused!