I Need jump only one time : (
I need jump only one time when jumping
Please Im really greatfully :D
sin-titulo.jpg
(68.6 kB)
Comment
Answer by lstaff · Apr 14, 2016 at 05:58 AM
Hi, Next time use 'code' for share code please. Use this:
void Control()
{
if (Input.GetKeyDown("space") && isGrounded)
{
rb.AddDorce(Vector2.up * JumpHeight, ForceMode2D.Impulse);
isGrounded = false;
}
}
And use this event: You need to create tag Ground.
void OnCollisionEnter(Collision col)
{
if (col.gameObject.tag == ("Ground") && isGrounded = false)
{
isGrounded = true;
}
}