Game Development Community

Problems with gui

by Rogers Vizcaino · in Torque Game Builder · 08/01/2006 (12:51 pm) · 4 replies

Allright, here's a little problem that i have

i have this function to show or hide a bitmap when my player deads
this is a gui that i've created before with a png and that shows the DEAD Image

//function to show Dead Bitmap
function muertoGui::toggleMenu(%this)
{
   if(!%this.isAwake())
   {
      Canvas.pushDialog(%this);
   }
   else
   {
      Canvas.popDialog(%this);
   }
}

now i call this function from my PlayerFish::dead function this way

function PlayerFish::dead(%this)
{
   //%this.schedule(1000,"muertoGui.toggleMenu()");
   muertoGui.toggleMenu()

   %this.setFlipY(true);
   %this.dead = true;
   %this.life=0;
}

Ok, some of my questions are:

1. I wanted to schedule the call to the function with %this.schedule(1000,muertoGui@".toggleMenu") but it doesn't work, i also tried %this.schedule(1000,"muertoGui.toggleMenu") and %this.schedule(1000,"muertoGui.toggleMenu()") but nothing seems to work.

2. Calling the function directly without schedule... muertoGui.toggleMenu() the image appears but it disappears almost instantly. i want to see the bitmap a little bit more in screen.

3. When i saved the gui i called it muertoGui.gui when i close TGB and load it again the muertoGui.gui doesn't exist. And then i have to create it again.

#1
08/01/2006 (2:59 pm)
1. You are scheduling the function on the wrong namespace. It's trying to call:

[ThisPlayerFish].muertoGui.toggleMenu()();

Try this:
muertoGui.schedule(1000, "toggleMenu");

2. It sounds like your PlayerFish::dead function is being called multiple times.

3. You have to exec your gui file in order for TGB to know about it.
#2
08/01/2006 (3:15 pm)
Thank you man, 1 and 2 solved but there's still a problem with 3

function initializeProject()
{
   // Load up the in game gui.
   exec("~/gui/muertoGui.gui");

blah blah
}

i have this in my main.cs
#3
08/01/2006 (3:32 pm)
Thank you man, 1 and 2 solved but there's still a problem with 3

function initializeProject()
{
   // Load up the in game gui.
   exec("~/gui/muertoGui.gui");

blah blah
}

i have this in my main.cs
#4
08/01/2006 (6:06 pm)
Are you actually saving the GUI in the editor?