- Home /
Question by
Cryno1000 · Nov 28, 2019 at 05:57 AM ·
enemypathfindingenemy aitracking
Enemy follow script without rotation
Hey there. I'm working on my first game and I'm making a top-down shooter (kinda 8-bit). The thing is, I can't find any good scripts for enemies to move to my player WITHOUT rotating.
So my question is, how can I make it so that enemies always follow the player, without rotating, but rather changing their sprite when the player is to the left/right/above/below them?
Thanks in advance.
Comment
Answer by studuo41 · Nov 28, 2019 at 06:52 AM
if (target != null)
rb.MovePosition(Vector2.MoveTowards(transform.position, target.transform.position, Speed));
put this code in Update method and set the target to what you want enemy follow and speed for movent speed
Your answer
![](https://koobas.hobune.stream/wayback/20220612215407im_/https://answers.unity.com/themes/thub/images/avi.jpg)