Game Development Community

Add scripts to the game.cs file

by Spider_Man · in Technical Issues · 08/10/2006 (5:11 pm) · 10 replies

Hi everyone,

i'm following the Fish tutorial with the TGB engine ... and every time i add Fish move script , my fild wont work.

Could you please advice me about how to add any script inside the game.cs file .

i'm newbies and i really wish you kindly guide me slowly :)

P.S: Sorry to post in here and another lace in forum , forgive kindly huys :)

regards

#1
08/10/2006 (5:30 pm)
Open .cs file with notepad, type functions, save
when you run press tilda '~' and be sure that file compiled and that there are no errors in the console
#2
08/10/2006 (5:48 pm)
I'm working on Fish demo tutorial

and i just added the below script :

function FishClass::onLevelLoaded(%this, %scenegraph)
{
%this.setLinearVelocityX(20);
}
Code


to the end of game.cs


The fish swim forward and get error on screen

any advice please


P.S: i have 2 game.cs files , on in project root , other one in gamescripts folde. And i added above script to the game.cs inside of gamescripts.

regards
#3
08/10/2006 (5:51 pm)
What is the error
#4
08/10/2006 (5:53 pm)
It says ...

game.cs Line39 - Syntax error

Check console (Press'~') for details.


Thanks
#5
08/10/2006 (5:55 pm)
Do so , tell me what errors the console reads
#6
08/10/2006 (5:55 pm)
It says ...

game.cs Line39 - Syntax error

Check console (Press'~') for details.


Thanks
#7
08/10/2006 (6:04 pm)
So, any possible advice please ?
#8
08/10/2006 (6:12 pm)
You are not telling me what the console reads press 'tilda' look thru the console and read the error, go to the line in the file and fix the syntax
#9
08/10/2006 (6:21 pm)
Okay .. could you look on this pic (a capture from engine)

http://iraqcyber.com/up/pic/error.jpg
#10
08/10/2006 (6:22 pm)
And the line 39 contains :

endGame();