Game Development Community

Problem when loading first level after introduction.

by Steve Nolet · in Torque Game Builder · 07/14/2006 (11:02 am) · 5 replies

I make a game with an introduction. I use cine_MainScreen.gui to make this introduction. This introduction is like a level. When this intro is end, I switch to MainScreen.gui and load the first level. The GUI work great and the level is correctly loaded but I cannot see level, it's all black. Why ? I tested the first level whitout the intro and it's work. It's not work just when I play intro before. I used MainScreen.gui as base to make cine_MainScreen.gui.

(scuse for my english)

#1
07/14/2006 (6:16 pm)
If you copied this line from mainScreen.gui:

new t2dSceneWindow(sceneWindow2D)

...then you might be overwriting the sceneWindow2D name. Post your cine_mainScreen.gui and the script where you are switching from one to the other. Maybe I can help.
#2
07/14/2006 (7:51 pm)
Here is my cine_mainScreen.gui

//--- OBJECT WRITE BEGIN ---
new GuiChunkedBitmapCtrl(cine_mainScreenGui) {
   canSaveDynamicFields = "0";
   internalName = "cine_mainScreenGui";
   Profile = "GuiContentProfile";
   HorizSizing = "width";
   VertSizing = "height";
   position = "0 0";
   Extent = "1024 768";
   MinExtent = "8 8";
   canSave = "1";
   Visible = "1";
   hovertime = "1000";
   bitmap = "~/data/images/back_black.PNG";
   useVariable = "0";
   tile = "0";

   new t2dSceneWindow(sceneWindow2D) {
      canSaveDynamicFields = "0";
      internalName = "sceneWindow2D";
      Profile = "GuiContentProfile";
      HorizSizing = "width";
      VertSizing = "height";
      position = "0 0";
      Extent = "1024 768";
      MinExtent = "8 8";
      canSave = "1";
      Visible = "1";
      hovertime = "1000";
      lockMouse = "0";
      useWindowMouseEvents = "1";
      useObjectMouseEvents = "0";
   };
   new GuiControl() {
      canSaveDynamicFields = "0";
      Profile = "ClearWindowProfile";
      HorizSizing = "right";
      VertSizing = "bottom";
      position = "170 496";
      Extent = "692 147";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      hovertime = "1000";

      new GuiMLTextCtrl(txtCinematique) {
         canSaveDynamicFields = "0";
         Profile = "BodyTextProfile";
         HorizSizing = "right";
         VertSizing = "bottom";
         position = "8 0";
         Extent = "677 18";
         MinExtent = "8 2";
         canSave = "1";
         Visible = "1";
         hovertime = "1000";
         lineSpacing = "2";
         allowColorChars = "0";
         maxChars = "-1";
         text = " ";
      };
      new GuiTextCtrl() {
         canSaveDynamicFields = "0";
         Profile = "BodyTextProfileBig";
         HorizSizing = "right";
         VertSizing = "bottom";
         position = "248 115";
         Extent = "222 34";
         MinExtent = "8 2";
         canSave = "1";
         Visible = "1";
         hovertime = "1000";
         text = "<< Press Enter >>";
         maxLength = "1024";
      };
   };
};
//--- OBJECT WRITE END ---

Here is I switch from one to the other

function startLevel1()
{
   // Set The GUI.
   Canvas.setContent(mainScreenGui);
   Canvas.setCursor(DefaultCursor);
   
   sceneWindow2D.loadLevel("Humanity_last_hope/data/levels/hlhEP1_Level1.t2d");
   
   moveMap.push();
   InitVariables();
   LoadSoundEffect();
   LoadMusic();
      
   schedule(1000,0, "TimeCount");
}
#3
07/17/2006 (5:28 pm)
I found solution. Now it's work great. I modified 3 lines of code and now it's work. :)
#4
07/17/2006 (5:35 pm)
Did you fix the overwriting of SceneWindow2D? That might cause you problems later.
#5
07/17/2006 (5:43 pm)
Yes, I named SceneWindows2D of my cine_MainscreenGui cine_SceneWindows2D and when I load introduction, I changed
sceneWindow2D.loadLevel("Humanity_last_hope/data/levels/hlhEP1_preLevel1.t2d");

for

cine_sceneWindow2D.loadLevel("Humanity_last_hope/data/levels/hlhEP1_preLevel1.t2d");

and now it's work.

Tanks for your help. :)