Game Development Community

A pause screen gui

by Michael Roberts 13 · in Torque 3D Beginner · 01/22/2015 (4:32 pm) · 4 replies

hey everyone im back with another question i need some scripting help to create a gui where the player can pause and the game(with a background picture) i thought it was simple but i was wrong so i really need your help GG community.

About the author

13 year old teen,n00b scriptor but skillful in 3d artists.Gamer 4 life


#1
01/23/2015 (4:48 am)
You're right it doesn't seem like it will be too hard but as with everything we need to learn it. I'll try to help.
#2
01/23/2015 (5:21 am)
I assume pausing the game would involve pausing the process list that ticks the objects in the game, as well as the physics simulation if you are using bullet/physX. That would involve messing with the engine. Make a variable exposed to torquescript, and use that to toggle between processing.
#3
01/23/2015 (3:25 pm)
T2D and T3D are siblings - see how T2D implements Scene::SetScenePause(), there may be some gems that will apply.
#4
01/24/2015 (10:44 pm)
I searched around and found a quick and dirty way but it works. Still took some work. Sound stays on so there's something to work on.

Here's what I did.

Found a menu screen on OpenGameArt just as an example. Added text in Photoshop. It say's "Pause Menu" at top and "Continue" at bottom.

Created pauseMenu.gui in the GUI Editor with a bitmap and one button.

I used this function in default.bind.cs and bound it to "m" (I was thinking "map" perhaps.

function pauseGame() 
 {
      
      $timescale = 0; // stops time
      Canvas.pushDialog( pauseMenu ); // opens pauseMenu.gui
   
 }

  
GlobalActionMap.bind( keyboard, "m", pauseGame );


Here's pauseMenu.cs


function pauseMenu::btnClose()
{
  $timescale = 1; //starts time again
  Canvas.popDialog(pauseMenu); //closes gui
  
}

As you can see I just stopped time with "m" until you start time again by clicking continue. You can easily make your own gui with this as an example.

Here's the code and .png files with simple instructions for adding the execute commands to init.cs and default.bind.cs.

www.mediafire.com/download/gr19o3oonnjiaca/Pause_Menu.zip