Game Development Community

Why does

by CodingChris · in Torque Game Engine · 08/25/2007 (8:17 am) · 2 replies

Hi,
I want to add a missionpreview camera before the game started. The camera works fine, but I can't start the game. That's my code:
function PlayGui::click()
{
	echo("Play me if you can");
        startgame();
 
}
Could anybody help me please?

#1
08/25/2007 (9:21 am)
PlayGui::click() is not a function.

You might want to create a different gui for your mission preview cam, and put a mouse event control on it. Then, you will be able to use the "onMouseDown" function to switch to your playgui and setup your start your game.

example:
You could throw this code at the bottom of playGui.gui
new GameTSCtrl(PreviewGui) {
   canSaveDynamicFields = "1";
   profile = "GuiContentProfile";
   horizSizing = "right";
   vertSizing = "bottom";
   position = "0 0";
   extent = "800 600";
   minExtent = "8 8";
   visible = "1";
   helpTag = "0";

   new GuiMouseEventCtrl(PreviewEvent) {
      canSaveDynamicFields = "1";
      profile = "GuiDefaultProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "0 0";
      extent = "800 600";
      minExtent = "8 8";
      visible = "1";
      helpTag = "0";
   };
};

function PreviewEvent::onMouseDown(%control)
{
   Canvas.setContent( PlayGui );
   startgame();
}

Assuming you are using starter.fps as a base, you will also have to open client/scripts/serverConnection.cs and change line 40 from
Canvas.setContent(PlayGui);
to
Canvas.setContent(PreviewGui);

That's the basic idea, though I would check for bugs before copying and pasting.
#2
08/25/2007 (9:59 am)
Thanks, that works!