discord:Andreea#9114
You can use a bool canJump; then you can set it to whether the player can jump or not, then you check if they can jump when they try to jump, if(canJump)
If you want a physical break, as in a time interval between the next jump, use coroutines. For example (based on logicandchaos’s solution):
bool CanJump;
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
if (CanJump)
Jump();
}
void Jump()
{
CanJump = false;
// Actually jump (do this yourself)
// Wait 1 second before player can jump again
StartCoroutine(BreakTime(1));
}
IEnumerator BreakTime(float delay)
{
yield return new WaitForSeconds(delay);
CanJump = true;
}
Also, on another note, you should never ask for someone to do it for you. Take a crack at it, and if you didn’t get it, or the solution didn’t work for you, kindly ask for a better explanation.