Creating TGB/TGE Splash Screens
Start by creating a new project or editing one that you have existing.  In the game.cs file add this line of code towards the bottom:
  playsplash0();
    
After that create your two GUI's of your splash screens, I am not going to go over creating the GUI's but I'll give you mine as an example.
//--- OBJECT WRITE BEGIN ---
      %guiContent = new GuiFadeinBitmapCtrl(Splash0) {
  canSaveDynamicFields = "0";
  isContainer = "1";
  Profile = "GuiDefaultProfile";
  HorizSizing = "right";
  VertSizing = "bottom";
  Position = "0 0";
  Extent = "800 600";
  MinExtent = "8 2";
  canSave = "1";
  Visible = "1";
  hovertime = "1000";
  bitmap = "~/data/images/Splash0.jpg";
  wrap = "0";
  fadeinTime = "750";
  waitTime = "2500";
  fadeoutTime = "500";
  done = "0";
  };
  //--- OBJECT WRITE END ---
    
then you are going to want to create the Splash.cs file mine was modeled off of a tutorial i did a while back, it's pretty simple and straightforward.
// ============================================================
      // Project            :  Flash Cards
      // File               :  .\game\gameScripts\Splash.cs
      // Copyright          : 
      // Author             : Brent Jorgenson
      // Created on         :  Tuesday, September 15, 2009 1:35 PM
      //
      // Editor             :  TorqueDev v. 1.2.3430.42233
      //
      // Description        : 
      //                    : 
      //                    : 
      // ============================================================
function playsplash0(){
      canvas.setcontent(Splash0);
      schedule(100,0,checksplash0);
      echo("Splash 1 init");
      }
function checksplash0(){
      if(splash0.done)
      {
      playsplash1();
      }
      else{
      schedule(100,0,checksplash0); 
      }
      }
function playsplash1(){
      canvas.setcontent(Splash1);
      schedule(100,0,checksplash1);
      echo("Splash 2 init");
      }
function checksplash1(){
      if(Splash1.done){
      //startGame("MyProjectFolder/data/levels/MyLevel.t2d");
      }
      else{
      schedule(100,0,checksplash1); 
      }
      }
Next thing you want to do is exec these files
exec("./Splash.cs");
exec("~/gui/Splash0.gui");
      exec("~/gui/Splash1.gui");
The only other things to do is add your startgame function or uncommend the one I have in the function checksplash1() put your main menu or first level there and you should be good to go, test it out and have a blast!
Other Tutorials on this topic:
      http://tdn.garagegames.com/wiki/TGB/Tutorials/Multiple_Splash_Screens
      http://tdn.garagegames.com/wiki/TGB/Tutorials/SplashScreen

0 comments:
Post a Comment