private void Moviment() { if (CanMove() && Input.GetKey(KeyCode.LeftArrow)) { // transform.Translate(Vector2.left * G_Walk_Speed * Time.deltaTime); G_Rigibody2D.velocity = new Vector2(Vector2.left.x * G_Walk_Speed, G_Rigibody2D.velocity.y); transform.localScale = new Vector2(-G_Normal_Scale.x, G_Normal_Scale.y); G_In_Walk = true; G_Anim.SetBool("InWalk", G_In_Walk); } if (CanMove() && Input.GetKey(KeyCode.RightArrow)) { // transform.Translate(Vector2.right * G_Walk_Speed * Time.deltaTime); G_Rigibody2D.velocity = new Vector2(Vector2.right.x * G_Walk_Speed, G_Rigibody2D.velocity.y); transform.localScale = new Vector2(G_Normal_Scale.x, G_Normal_Scale.y); G_In_Walk = true; G_Anim.SetBool("InWalk", G_In_Walk); } if (Input.GetKeyUp(KeyCode.LeftArrow) || Input.GetKeyUp(KeyCode.RightArrow)) { G_In_Walk = false; } Jump(); }
void FixedUpdate() { G_Anim.SetBool("InWalk", G_In_Walk); G_Anim.SetBool("Ground", inTheGround); }