Game Development Community

Shooter Demo

by Mario N. Bonassin · in Torque Game Builder · 06/20/2006 (2:13 pm) · 5 replies

Its looking good. I did find one issue I was going through the Shooter Demo and putting in the script. When I tried to run i kept getting errors and it wasn't working the way it was supposed to. I figured out what the problem was though.

On page 14 of the tutorial is says to add the following

exec("./gameScripts/player.cs");

in game.cs I did and that was the problem. It would keep looking for the file in "gameScripts/gameScripts/player.cs".

So I just changed it to this

exec("./player.cs");

and it worked fine.

#1
06/20/2006 (2:34 pm)
Ah, good catch. yea thats a typo. i believe that code snippet was originally written to go in the initializeProject function in main.cs (which is in the parent folder, so the path wouldve been valid), but was changed to startGame in game.cs in the gameScripts folder and i guess the path was just overlooked.

it was changed because startGame is a more appropriate place to execute it. theres no need to load player.cs until the game actually starts. plus, you exec player.cs in startGame, the script will be recompiled every time the game is run (rather than every time the project is opened as in initializeProject), which makes modifying the code much more convinient as you dont have to close and reopen TGB every time you make a change.

in any case, youre absolutely right.
#2
06/20/2006 (2:35 pm)
Yea, sorry about that, we decided to change the exec statements to exec from game .cs (originally they were in main.cs) and I guess I missed updating that one. Thanks for the catch!

Edit: I just changed the document and commited the new version...it should be correct in all of the subsequent releases. Thanks again for the catch!
#3
07/10/2006 (1:39 am)
Thanks Mario,

You saved me from a serious headache!
#4
08/30/2006 (5:41 am)
There is also changes to be made on page 18. Im looking at revision 2.4 :o)
#5
10/03/2006 (7:42 am)
Holy mackerel! You just solved two frustrating weeks. I tip my hat to you.