Problem with moving starship.
by Denis Linardic · in Torque Game Builder · 10/07/2005 (2:40 pm) · 4 replies
Hi guys!
I am following the basic tutorial and I can't get my ship to move. I know that i made a mistake but I cant see it. Help please :)
Maybe I am placing this code at wrong place?
I am following the basic tutorial and I can't get my ship to move. I know that i made a mistake but I cant see it. Help please :)
function setupT2DScene()
{
// Create fxSceneGraph2D.
new fxSceneGraph2D(t2dSceneGraph);
// Associate Scenegraph with Window.
sceneWindow2D.setSceneGraph( t2dSceneGraph );
// Set Camera Position to be centered on (0,0) with
// view width/height of (100/80).
sceneWindow2D.setCurrentCameraPosition( "0 0 100 75" );
//Player Control
// Create a new action map.
new ActionMap(playerMap);
// Bind keys to actions.
playerMap.bindCmd(keyboard, "w", "playerUp();", "playerUpStop();");
playerMap.bindCmd(keyboard, "s", "playerDown();", "playerDownStop();");
playerMap.bindCmd(keyboard, "a", "playerLeft();", "playerLeftStop();");
playerMap.bindCmd(keyboard, "d", "playerRight();", "playerRightStop();");
playerMap.bindCmd(keyboard, "space", "playerFire();", "");
// Activate the action map.
playerMap.push();
//Controling player
function playerUp()
{
// Set the player moving up.
$player.setLinearVelocityY( -10 );
}Maybe I am placing this code at wrong place?
About the author
#2
10/07/2005 (2:58 pm)
Thanks, it works now!
#3
10/07/2005 (3:14 pm)
Good. When the new version comes out it is supposed to have better notification of compilation errors which should help with this sort of problem (I now have an ingrained habit of checking the startup log).
#4
10/07/2005 (4:15 pm)
And a good habbit i might add ;)
Torque Owner Tim Doty
Hit the tilde key to open the console and scroll up to see if there are any errors on startup (they will be colored red).