Basic Tutorial - Ship not moving
by Vern Jensen · in Torque Game Builder · 06/16/2006 (3:07 pm) · 2 replies
I'm using TGE RC1 on MacOS X. I've gotten through the Basic Tutorial to the part where the ship is supposed to move around.
I've copied and pasted the code into player.cs verbatim. I've verified that .cs really is the true extension. I've also modified main.cs to contain:
exec("./gameScripts/player.cs");
I've also modified the ship's Scripting fields to have:
Name: pShip
Class: playerShip
and Dynamic Fields to have:
hSpeed 100
vSpeed 80
No movement when I run.
I've also tried modifying the updateMovement function in player.cs to contain this as the last line:
%this.setLinearVelocityY( 20 );
So it *should* move vertically regardless of any keypresses. But still nothing when I run.
Do I need to compile the script or something when I run it? I notice a "game.cs.dso" in the gameScripts folder, but there is no "player.cs.dso" in that folder after I run. (I'm assuming .cs.dso is the compiled version.)
-Vern
I've copied and pasted the code into player.cs verbatim. I've verified that .cs really is the true extension. I've also modified main.cs to contain:
exec("./gameScripts/player.cs");
I've also modified the ship's Scripting fields to have:
Name: pShip
Class: playerShip
and Dynamic Fields to have:
hSpeed 100
vSpeed 80
No movement when I run.
I've also tried modifying the updateMovement function in player.cs to contain this as the last line:
%this.setLinearVelocityY( 20 );
So it *should* move vertically regardless of any keypresses. But still nothing when I run.
Do I need to compile the script or something when I run it? I notice a "game.cs.dso" in the gameScripts folder, but there is no "player.cs.dso" in that folder after I run. (I'm assuming .cs.dso is the compiled version.)
-Vern
#2
Suggestions? I'm using TGB v1.0 (the one released a few days ago). I'm also using the current version of Torsion, although as little more than a text editor (I did try everything using notepad as well, but same result).
I'm new to TGB and just started looking at it this week, so I'm assuming some sort of user error. I just have no idea where to look to isolate the problem.
kg
Update: ok, it wasn't finding the player.cs file. I changed the path to just "./player.cs" in the game.cs file (i.e. exec("./player.cs"); ). That works, but doesn't explain what was wrong with the original path.
06/23/2006 (4:16 pm)
I'm having the same issue. I'd caught the smart quotes problem earlier, but I'm still not getting any movement. I tried the same test above (setting the velocity to a constant value) to no effect, so I'm assuming this code is just never being reached.Suggestions? I'm using TGB v1.0 (the one released a few days ago). I'm also using the current version of Torsion, although as little more than a text editor (I did try everything using notepad as well, but same result).
I'm new to TGB and just started looking at it this week, so I'm assuming some sort of user error. I just have no idea where to look to isolate the problem.
kg
Update: ok, it wasn't finding the player.cs file. I changed the path to just "./player.cs" in the game.cs file (i.e. exec("./player.cs"); ). That works, but doesn't explain what was wrong with the original path.
Torque Owner Vern Jensen
exec("./gameScripts/player.cs");
had *smart quotes* insteaed of normal quotes. Apparently, when you copy from the PDF file and paste into XCode (what I'm using as a text editor, but the same problem occurs in TextEdit), normal quotes get changed to smart quotes along the way. Changing those to normal quotes solved the problem, and now my ship is moving.
If anyone from Torque is reading this, you might want to add a note to the Tutorial about being careful with copy & paste because of this. I'm not sure if
-Vern