Im trying to add a glide to my character after he double jumps.
This is my code for double jumping which i got from blackthornprods tutorial on it.(Modified a little)
if (isGrounded)
{
extraJumps = extraJumpsValue;
}
if (Input.GetKeyDown(“space”)&& isGrounded)
{
rb2d.velocity = Vector2.up * jumpForce;
}else if (Input.GetKeyDown(“space”) | && extraJumps > 0)
{
rb2d.velocity = Vector2.up * jumpForce;
extraJumps–;
}
This is my code for gliding.
if(Input.GetKey(“space”)&&!isGrounded&&extraJumps==0)
{
rb2d.velocity =new Vector2(rb2d.velocity.x, rb2d.velocity.y*glideValue);
}
It doesn’t activate at all in this state. It kinda works if I attach it to the jump code with an ‘else’ but i would have to press space three times in order to glide and it feels off. I just want to glide after space is pressed the second time. If anyone knows what I’m doing wrong i would appreciate any help.