I have this simple script when I click the screen the dude walks there, but once reached the position clicked he’s just stuck in the walk loop!
How do I say, If reached the position clicked and the target has reached that position to stand?
void Update () {
if (Input.GetMouseButtonDown(0)) {
SkelAnim.state.SetAnimation(0,walk,true);
target = Camera.main.ScreenToWorldPoint(Input.mousePosition);
}
transform.position = Vector2.MoveTowards(transform.position, target, speed * Time.deltaTime);
}
}