- Home /
2D/Top Down Enemy Follow
Hi there!
I am trying to make my Enemies follow the player in a simple top down 2D fighting game.
At the moment, the following script seems is not working for 2D, as the enemies "Flip" to face the player and also seem to be behaving in 3D. What is a simple alternative to make the enemies follow the player?
LookAt is causing the issue I think..
transform.LookAt(Player);
if(Vector2.Distance(transform.position,Player.position) >= MinDist)
{
transform.position += transform.forward*MoveSpeed*Time.deltaTime;
}
Comment
transform.position += (player.transform.position - transform.position).normalized $$anonymous$$oveSpeed Time.deltaTime;
Thats the answer! Replace move code with that..
Your answer
Follow this Question
Related Questions
Enemy AI Problem 0 Answers
Need help with enemy AI 1 Answer
Enemy Targetting Help 1 Answer
Enemies running when they should be following. 1 Answer
Enemy backing away from player after going around corner? 1 Answer