GettingStarted.pdf tutorial problem
by Andy_G · in Torque Game Engine · 09/16/2007 (4:51 pm) · 7 replies
I think the GettingStarted.pdf tutorial is bad at the scripting part, after i entered these lines individually, i tested if everything worked and they did but... in game when moving the mouse up/down or left/right the camera is still the screen was standing still! i need to complete this tutorial, please check the code below and tell me where it's bad.
these are the script i added to "logoitem.cs"
function TorqueLogoItem::onCollision(%this, %obj, %col)
{
if(%col.getClassName() $= "Player")
{
%client = %col.client;
%client.score++;
commandToClient(%client, 'SetScoreCounter', %client.score);
%obj.delete();
%logoCount = logos.getCount();
if(%logoCount > 0)
return;
// otherwise display victory screen
commandToClient(%client, 'ShowVictory', %client.score);
}
}
also i added the below to a new file named "clientGame.cs"
function clientCmdSetScoreCounter(%score)
{
ScoreCounter.setText("Score:" SPC %score);
}
function clientCmdShowVictory(%score)
{
MessageBoxYesNo("You Win!",
"Would you like to restart the game ?",
"loadMyMission();",
"quit();");
}
and this line to "main.cs" under "Client scripts" as stated in the tutorial
exec("./client/clientGame.cs");
these are the script i added to "logoitem.cs"
function TorqueLogoItem::onCollision(%this, %obj, %col)
{
if(%col.getClassName() $= "Player")
{
%client = %col.client;
%client.score++;
commandToClient(%client, 'SetScoreCounter', %client.score);
%obj.delete();
%logoCount = logos.getCount();
if(%logoCount > 0)
return;
// otherwise display victory screen
commandToClient(%client, 'ShowVictory', %client.score);
}
}
also i added the below to a new file named "clientGame.cs"
function clientCmdSetScoreCounter(%score)
{
ScoreCounter.setText("Score:" SPC %score);
}
function clientCmdShowVictory(%score)
{
MessageBoxYesNo("You Win!",
"Would you like to restart the game ?",
"loadMyMission();",
"quit();");
}
and this line to "main.cs" under "Client scripts" as stated in the tutorial
exec("./client/clientGame.cs");
About the author
#2
Try adding this line to your playGui.gui script at the end of the main control:
09/17/2007 (8:15 am)
You been doing any GUI editing, specifically the playGui? Sometimes the mouse is invariably enabled, once this happens all focus is given to the GUI meaning that the standard yaw/pitch functions stop working.Try adding this line to your playGui.gui script at the end of the main control:
noCursor = "1";
#3
09/18/2007 (2:45 am)
Yes i have and i can also see the cursor it's unusual, the cursor should not be visible in game.
#4
09/18/2007 (2:57 am)
Aye, that's why you need to add "noCursor = "1";" to any GUI's that are open during game-play, usually the PlayGui.
#5
09/18/2007 (2:57 pm)
Yes thank you, i get it now :-)
#6
I added the below to the "playGui.gui" in many ways i.e start, middle, bottom.
09/18/2007 (3:12 pm)
That diden't actually work, it's still the same, no camera movement. I added the below to the "playGui.gui" in many ways i.e start, middle, bottom.
noCursor = "1";
#7
09/18/2007 (3:18 pm)
Are you sure it's from my GUI editing? because i remember closing and restarting TGE right after i added the ingame "Score: 0" GUI.
Andy_G