Game Development Community

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 :)

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?

#1
10/07/2005 (2:45 pm)
From the above it looks like the setupT2DScene() function isn't closed, or at least encloses the playerUp() function. Make sure that the code is compiling and you're not running from an old version.

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).
#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 ;)