Moving the player up and down
by Liu Yi · in Torque Game Engine · 10/18/2006 (3:20 am) · 2 replies
In my game i want the player to have the ability to fly. Therefore, in addition to moving forward, backward, left, and right, the player should also be able to move up and down.
I checked the script of start.fps. In the file ".\client\scripts\default.bind.cs", there is such code:
function moveup(%val)
{
$mvUpAction = %val * $movementSpeed;
}
function movedown(%val)
{
$mvDownAction = %val * $movementSpeed;
}
So I add the following lines:
moveMap.bind( keyboard, t, moveup );
moveMap.bind( keyboard, g, movedown );
However, when I press "t" or "g" in the game, the player still has no action.
I searched through the engine code of player.h and player.cc, and can't found the code that controls the movement of the player. I don't know how the engine provide the player with actions like moving left or moving right, so I can't make changes to it to enable the player to move up and down.
Can someone point out which part of the code I need to make the necessary changes in order to move the player up and down? Thanks.
I checked the script of start.fps. In the file ".\client\scripts\default.bind.cs", there is such code:
function moveup(%val)
{
$mvUpAction = %val * $movementSpeed;
}
function movedown(%val)
{
$mvDownAction = %val * $movementSpeed;
}
So I add the following lines:
moveMap.bind( keyboard, t, moveup );
moveMap.bind( keyboard, g, movedown );
However, when I press "t" or "g" in the game, the player still has no action.
I searched through the engine code of player.h and player.cc, and can't found the code that controls the movement of the player. I don't know how the engine provide the player with actions like moving left or moving right, so I can't make changes to it to enable the player to move up and down.
Can someone point out which part of the code I need to make the necessary changes in order to move the player up and down? Thanks.
#2
I used Tim Heldna's great JetPack resource.
Here's the link: www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=11314
10/18/2006 (9:12 am)
Hi Lui,I used Tim Heldna's great JetPack resource.
Here's the link: www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=11314
Torque Owner Tod Kuykendall
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2359
There is also a thread on making your character fly here:
http://www.garagegames.com/mg/forums/result.thread.php?qt=32256
I think there are a couple variations depending on what you want to do but either "jetpack" or "flying" is definitely the place to start.
HTH
=Tod