Make it so you cant jump in air
For now this is how i handle jumping in the game
void Jump ()
{
if (Input.GetButtonDown("Jump") && Grounded)
{
rb.AddForce(new Vector2(0f, jumpForce), ForceMode2D.Impulse);
Grounded = false;
}
}
void OnCollisionEnter2D(Collision2D collision)
{
if(collision.gameObject.tag == "Ground")
{
Grounded = true;
}
}
And if you skim through it you can quite quickly see what the problem is, so basically i set Grounded to false when i jump but if i were to say walk off a ledge it isnt set to false so how could i make it so i cant jump when im in the air?
Comment