Hey dudes I'm currently working on a game using physics and I need to make a cooldown between jumps because currently if you spam the up arrow key you will literally just fly. The only thing I can think of is something like
Global variable jumpCooldown = 0;
keyboard, key is pressed -
if (jumpCooldown = 0) {
apply physics force etc..
}
keyboard, key is pressed - wait 0.1 seconds - set jumpCooldown = 1;
wait 2 seconds - set jumpCooldown = 0;
this is super flawed but the only thing i could really think of
(When the up arrow is pressed it sets the jumpCooldown variable to 1 after 0.1 seconds and reverts to 0 after say 2 seconds. Then an if statement checks if the variable is equal to 0 and then applys the physics force to create the jump, if it equals 1 it does nothing.)) and im fine trying to learn how to script this if i have to
I'd be super grateful for any help.