Game Development Community

Splash Screen Problems

by John Paul Koczan · in Torque Game Builder · 04/20/2006 (5:36 pm) · 4 replies

The stupid question to end all stupid questions...

I just want to add a new splash screen at the start of the game (the very first thing you'd see). I started a new project in TGB Beta 2 and looked at the code from the space shooter demo. It doesn't seem too tricky, but when I add my "splashScreen.gui" file to the gui folder of my project and add the files, nothing happens. Has anyone else ran into this problem? I have a feeling it's a really simple answer and I'm missing something obvious. Any help would be greatly appreciated. Thanks in advance.

#1
04/20/2006 (7:38 pm)
It's not a stupid question at all... because the init scripts are all changed in Beta 2. What I would do (intend to do but it ain't working quite right) is add this to initializeProject():
// Load up the in game guis.
exec("./gui/splashScreen.gui");
splashScreenLoad(); 
// comment this out and put it somewhere else because
// we just loaded the splash screen:
// startGame("~/data/levels/baseLevel.tgb");

Then in splashScreen.gui when the splash screen is finished (timeout or mouse click)
function closeSplashGui()
{
   startGame("~/data/levels/level1.t2d");	
}
hope this helps give you some ideas
#2
04/21/2006 (6:15 am)
I followed the tutorial here: tdn.garagegames.com/wiki/Torque_2D/StandardTutorials/Basics/SplashScreen If you're using Beta2 then there might be a few differences (for example it mentions the onStart() function which in Beta2 is InitializeProject() )

Following the tutorial I had to add some functions into the .gui file (open it up in a text editor) to handle showing and hiding the splashscreen and had to add calls to those functions in the main.cs file. Its just a hunch but I'm guessing that's where the problem is?
#3
04/22/2006 (9:55 am)
I had a seperate post about that turorial... what exactly did you have to change? And could you read my other post (splash screen tutorial problem).
#4
04/22/2006 (10:05 am)
Basically, you want to create your splash screen, then exec() the script, a Alex said, and comment out the startGame() call.
Replace the startGame() call with loadSplash().
In your splash .cs.gui file, after the --- OBJECT WRITE END --- insert:
// code from http://tdn.garagegames.com/wiki/Torque_2D/StandardTutorials/Basics/SplashScreen
function loadSplash()
{
   canvas.setContent(Splash);
   schedule(100, 0, checkSplash);
}

function checkSplash()
{
   if (Splash.done)
      startGame("T2D/data/levels/mybaselevel.t2d");
    else
      schedule(100, 0, checkSplash);
}

That should work, if your GUI Splash screen is named "Splash". :)

- Tom.