Game Development Community

Atempting to create a throttle movement system

by Isaac Dutton · in Torque Game Engine · 07/17/2006 (12:23 pm) · 1 replies

Ok I have the following code, its in default.bind.cs. I edited the moveforward function.


%Throttle = 0;

function moveforward(%val)
{

while (%Throttle < 100 && %val = 1)
{
%Throttle = %Throttle + 1;

}

$mvForwardAction = %Throttle * $movementSpeed;
echo(%Throttle);
echo( $movementSpeed);
echo($mvForwardAction);
}


What I am atempting to do here is make it so when the W key is held the player throttles up. This will make the player move faster as the throttle is held.


The problem is that the throttle goes up REALLY fast I kinda want a variable on how fast it goes up to make for accleration rates on the players movement.

#1
07/17/2006 (12:26 pm)
Check out the getRealTime() function... it returns the system time in miliseconds.