- Home /
This question was
closed Aug 12, 2012 at 07:37 PM by
aldonaletto for the following reason:
Duplicate Question - http://answers.unity3d.com/questions/300452/how-to-do-a-jump-relative-to-the-time-the-key-spen.html
How to do 2 distinctives jumps relative to the time the key spent down?
i did this :
if (Input.GetKey(KeyCode.Space))
{
inputTime = Time.time ;
}
if (Input.GetKeyUp(KeyCode.Space))
{
if ( Time.time - inputTime < 0.2)
{
moveDirection.y = jumpSpeed;
}
else
{
moveDirection.y = jumpSpeed * 1.3f;
}
}
it's working but i want the same thing when the key is pressed down not up. How can i do that ?
Comment
Follow this Question
Related Questions
how to do a jump relative to the time the key spent down ? 2 Answers
Changing jump speed so that different height jumps take exactly the same amount of time? 0 Answers
Is It Bad To Have Your Jump In Update()? 3 Answers
Jump, fall, and after determined time it's able to jump again. 2 Answers
Health Regeneration speeds up when action performed? 1 Answer