Question by
Keefa1 · Dec 29, 2021 at 11:05 PM ·
functionsfollow playeranimation events
How do I make an enemy follow the player in an animation event?,How do I make a character move using a animation event?
So I need a slime to chase the player but the slime needs to squish before it goes forward so that means an animation but the problem is that it teleports instead of moving. When I use the exact same code outside of the function it works fine. public float speed; private Transform target; public GameObject otherObject;
public void Move()
{
transform.position = Vector2.MoveTowards(transform.position, target.position, speed /** Time.deltaTime*/);
}
// Start is called before the first frame update
void Start()
{
target = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
}
,
Comment
Best Answer
Answer by Keefa1 · Jan 02 at 06:32 PM
The animation event and the line of code work separately I found this with debug.log so it's not the function, it's not animation event and it's not telling me there is an error. please help.
Found it!
so you make it separate animations and follow this(v) video from 6:03 - 6:53 and 8:15 - 12:15 https://www.youtube.com/watch?v=AD4JIXQDw0s
Your answer