- Home /
Jump, fall, and after determined time it's able to jump again.
I have a jump script, the player jumps, and I want that a certain time after fall to the ground, the player is able to jump again. How do I do this in java script?
Answer by aldonaletto · Sep 22, 2011 at 12:38 PM
You should post your script - our telepathic powers are too limited to guess how to modify your script without knowing it! But you're lucky: I'm receptive today, so I can visualize something like the code below to modify your script:
var jumpInterval: float = 5; // interval between jumps (seconds) private var nextJump: float = 0; // time to jump again ... // modify your jump control this way: if (Input.GetButtonDown("Jump") && Time.time > nextJump){ nextJump = Time.time + jumpInterval; // here goes your current jump code } ...Hope my extrasensory power is correct, and this can help you. If yes, I'll risk some money in the lottery today; if not, please post your current script.
Answer by PauloPatez · Sep 22, 2011 at 02:09 PM
@aldonaletto Yes, your "extrasensory/telepathic power" is correct, sorry, I forgot to post my script. I tried this one solution, and it works fine, thank you.
Thanks to keep me informed: since my sensitivity seems good today, I'll definitely spend some money in the lottery! By the way, Unity Answers is different from forums: you should use the Your Answer box only to answer the question (answers are counted) - replies and comments should only be posted using the $$anonymous$$uscule add new comment button present in questions and answers. But I know that there's no warning about this, and that only new users with strong telepathic powers could guess this rule!
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Loading A Level After 40 Seconds 2 Answers
Is It Bad To Have Your Jump In Update()? 3 Answers
make an event occur after so many seconds? 1 Answer
deltatime glitches 1 Answer