Hello guys, I know alot of people asked to this, and I know there are alot of tutorials…but I really don’t know how to came out.
So, I followed a tutorial, and now my character is moving and jumping; but what about if I want him to double jump? What can I do in this case? Here the code I’m using
//ANIMATIONS
//PLAYER DIRECTION
if (moveX < 0.0f && facingRight == false)
{
FlipPlayer();
}
else if (moveX > 0.0f && facingRight == true)
{
FlipPlayer();
}
//PHYSICS
gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(moveX * playerSpeed, gameObject.GetComponent<Rigidbody2D>().velocity.y);
}
void Jump()
{
//JUMPING CODE
GetComponent<Rigidbody2D>().AddForce (Vector2.up * playerJumpPower);
Thank you all for the help!