I hope i can get help on this because have been trying for some time and cant get my head around it,. I have a triple jump in my game it is working perfect, but when i leave the grounded platform e.g fall off the edge i want to be able to still triple jump to try jump back up to the platform i fell off. For some reason i can only double jump after the fall heres my code:
if (Input.GetKeyDown(KeyCode.W)&& extraJumps >0)
{
rb.velocity = Vector2.up * jumpForce;
extraJumps--;
anim.SetTrigger("jump");
jumpSound.Play();
}
else if(Input.GetKey(KeyCode.W)&& extraJumps ==0 && isGrounded == true)
{
rb.velocity = Vector2.up * jumpForce;
Debug.Log("PlayAnim");
}
I think the problem may be rb.velocity part from when im grounded is there a way i can fix this to be able to triple jump after a fall… if anyone can help me that would be great thanks.