Game Development Community

How do I call .gui files to only load in certain levels?

by Path · in Technical Issues · 02/27/2009 (9:16 am) · 6 replies

I have a .gui that contains an .ogm cut scene that I need to know how to put in the main.cs code:

exec("~/gui/Level2cutscene.gui")

and

exec("~/gui/Level4cutscene.gui")

to load only when Level2 & Level4 are loaded?

I've tried with little luck the following script attempt in the main.cs:
function initializeProject()
{

exec("~/gui/mainScreen.gui");
exec("./gameScripts/game.cs");

function Level2::onLevelLoaded(Level2, %scenegraph)
{
exec("~/gui/Level2cutscene.gui")
}

function Level4::onLevelLoaded(Level4, %scenegraph)
{
exec("~/gui/Level4cutscene.gui")
}
}
Is their a better way like a standard gamescript.cs to accomplish this?

#1
03/07/2009 (11:26 am)
For those trying to figure out this problem, this post helped fill in a lot of blanks:

http://www.garagegames.com/community/forums/viewthread/48713

My only issue now is trying to figure out how to add functions to this .gui so I can control the click through & load next level command.

I pulled the functions from the GuiAviBitmapCtrl code, but can't seem to integrate them into theora even though they both have very similar structures.
#2
03/07/2009 (7:37 pm)
Any suggestions on how to make this code work for closing out my Theora video(plays fine) and going to the next level?

function MyVideoBehavior::onLevelLoaded(%this, %scenegraph)
{
     exec("~/gui/THEORATEST.gui");
     
        if ($playingVideo != 1)

   {
canvas.getContent().add(MyVideo);
      
Canvas.hideCursor();

      MyVideo.setFile("./game/data/images/TEST3.ogm");
   }
   else
   {
      Canvas.showCursor();
      MyVideo.stop();
      canvas.getContent().remove(MyVideo);    	
      sceneWindow2D.schedule(0, endLevel);
	   sceneWindow2D.schedule(1, loadLevel, expandFileName ("~/data/levels/level1.t2d"));
   }
}
#3
03/09/2009 (4:11 pm)
bump
#4
03/09/2009 (4:35 pm)
Have you tried a straight schedule instead of using sceneWindow2d.schedule(), or checking for console errors relating to those calls? Do you know what the state of $playingVideo is when you go into that function?
#5
03/09/2009 (5:31 pm)
1) What is the proper syntax/script for doing a straight schedule call?
[I'm simultaneously learning AS3 which causes obvious syntax confusion with C++]

2) playingVideo = 1; under the "if" statement. I removed it to see if it would have any impact. No impact, no error codes.

I also tried keeping playingVideo = 1; under the "if" and playingVideo = 0; under the "else" statement. No impact or error codes there either.
#6
03/10/2009 (10:58 am)
Can anyone spare further help?

I'm quickly approaching a deadline.