::Hi demilade, you will only be able to jump when the Grounded()
function returns true. That means that this section here needs to be true:
public bool Grounded()
{
if (Physics2D.Raycast(groundCheckPoint.position, Vector2.down, groundCheckY, whatIsGround)
|| Physics2D.Raycast(groundCheckPoint.position + new Vector3(groundCheckX, 0, 0), Vector2.down, groundCheckY, whatIsGround)
|| Physics2D.Raycast(groundCheckPoint.position + new Vector3(-groundCheckX, 0, 0), Vector2.down, groundCheckY, whatIsGround))
{
return true;
}
else
{
return false;
}
}
You need to make sure that your Ground Check X and Ground Check Y have non-zero values, your Ground Check Point is set, and the What Is Ground property is set to the correct layers.