Walking and Running
by Brodycat · in Torque Game Engine · 08/16/2005 (7:49 am) · 5 replies
I am trying to get my character to walk at normal movement speed and run when a button is held down. In starter.fps/client/scripts/default.bind.cs, I added the following code:
function dash(%val)
{
if (%val)
$movementSpeed = 2 * %speed;
}
And then farther below...
moveMap.bind( keyboard, a, dash );
Nothing seems to be happening when I press and hold the a button while walking. Is there more I need to do, or is my coding wrong?
function dash(%val)
{
if (%val)
$movementSpeed = 2 * %speed;
}
And then farther below...
moveMap.bind( keyboard, a, dash );
Nothing seems to be happening when I press and hold the a button while walking. Is there more I need to do, or is my coding wrong?
About the author
#2
08/16/2005 (12:34 pm)
Don't %val's only work with moveMap.bindCmd ?
#3
Oh, and thanks!
08/16/2005 (1:17 pm)
Ben --> Perhaps I could write dash as a trigger event, in order to revert speed to normal after letting go of the button? Or is sending a boolean to ther server for both press and release of the button preferable?Oh, and thanks!
#4
08/16/2005 (1:35 pm)
Tying dash functionality to a trigger would be a great solution.
#5
08/16/2005 (9:44 pm)
On a related note, I tried to trace the path of the code as the player takes a jump. I can't seem to find what is called when a jump is made, so I can't really mimic it for my run trigger! In starter.fps/client/scripts/default.bind.cs I find the trigger declarations and bindings, and in starter.fps/server/scripts/player.cs I find the parameters for the jump, such as height, as well as the top-level trigger function. But I can't find the jump ballstics or anything! I'd like to see the physics code so I can base my run trigger on it. What am I missing?
Associate Kyle Carter