Im trying to script a model running by tapping the left and right keys, the faster you tap them the faster they run. The character must simply run in a straight line.
Hopefully this is possible?
If anybody could lend me a land, please post =]
Re: Script to make models run using alternating keys.
[Re: ItsMe]
#204640 04/30/0813:2104/30/0813:21
you'd need to make a function that checks how long it takes to press, release and press a key. I think this will do, but haven't checked it. Use run_speed to move your character.
Code:
var tap_counter;
var run_speed;
...
while (1) {
if (key_cur || key_cul) {
tap_counter = 0;
while (key_cur || key_cul) { wait(1); } //wait for the key to be released
while (!key_cur && !key_cul) { tap_counter += 1 * time_step; wait(1); } //wait for the key to be pressed again, activate counter
run_speed = (key_cur - key_cul) * (1/tap_counter); //calculate direction and multiply by the 'slowness' of pressing key
}
wait(1);
}
Last edited by Joozey; 04/30/0813:22.
Click and join the 3dgs irc community! Room: #3dgs
Re: Script to make models run using alternating keys.
[Re: Joozey]
#206520 05/14/0800:2705/14/0800:27