Android double jump
Im doing 2D game for android and I have a problem with double jumping with my character. My code for jump and double jump in update section: /jumpForce is changable variable. tapCount is int, canDoubleJump bool./
tapCount = Input.touchCount;
if (grounded && (tapCount > 0))
{
canDoubleJump = true;
myRigidbody.velocity = new Vector2 (0, jumpForce);
tapCount = 0;
}
tapCount = Input.touchCount;
if(!grounded && (canDoubleJump == true) && (tapCount > 0))
{
canDoubleJump = false;
myRigidbody.velocity = new Vector2 (0, jumpForce * 1.3f);
tapCount = 0;
}
The problem is, that when I tap the screen, the player jump 2 times instantly. Do someone know where am I doing a mistake? :) Thank you guys for the answers.
Comment
Your answer
Follow this Question
Related Questions
My Android game is lagging.. 0 Answers
Building an Android game doesn't work 0 Answers
Unity 2D game heats up my phone!!! 1 Answer
Android Build Bug 0 Answers
,Android sprite lagging 0 Answers