Game Development Community

Pausing the animation and particle effect

by Kannan AMR · in Torque Game Builder · 04/15/2011 (5:37 pm) · 1 replies

I am trying to create an educational game in TGB, in which when an enemy is down, the screen pauses for 5 seconds to show some information. While the pause is working great, the little fire animation on the background is still playing along with the collision particle effect. Following is the part of the code for the pause function:

$MainScenePaused = true;
t2dSceneGraph.setScenePause(true);
$timeScale = 0.5;

freezeLevel.visible = true;
EnemeyName.visible = true;
EnemeyNameLabel.visible = true;
EnemeyName.setImageMap(%this.bigImageMap, 0);
%this.schedule(500, "hideEnemey");

I would like to know whether there is a better way to pause the game, so that even the particle effect and the fire animation attached to the player ship will also be paused (or hidden)?
Thank you in advance!

#1
04/16/2011 (9:43 pm)
You have:

t2dSceneGraph.setScenePause(true);

But the Scenegraph should be set to a Global variable, and then referenced

$thescenegraph = sceneWindow2D.getSceneGraph();

$thescenegraph.setScenePause(true);