Hi guys, I haven’t done unity in a while, so i forgot a lot stuff for coding. I was following the tutorial “2D Character Controllers” and things gone okay. The only problem i have is that when my player jump, the jumping animation didn’t play.
target = Camera.main.ScreenToWorldPoint (Input.mousePosition);
if ((grounded || !doubleJump) && Input.GetMouseButtonDown (0))
{
if (target.x <= transform.position.x) {
anim.SetBool ("Ground", false);
GetComponent<Rigidbody2D> ().AddForce (new Vector2 (speed, jumpForce));
target.z = transform.position.z;
transform.localScale = new Vector3 (-1, 1, 1);
rb2D.velocity = Vector3.left;
I changed few thing when i follow the tutorial.
I want my character to move AND jump using Input.mousePosition. My plan was to make my player constantly air jumping while dodging obstacles.
that works okay
but the only thing i need help with is
how do I play jumping animation every time my character jump?