2D top down airplane enemy pointers.


I’ve been working on side project where you shoot at space ships, to get high a score.
The issue now is that my enemy AI just looks at and fly’s towards the player constantly.
The behavior I want is for the enemy to let you get behind them, and/or out maneuver them.
I’m not asking for code, just some pointers, or a tutorial series.
I’m using Vector2.MoveTowards().
I will check daily so an answer will not go unnoticed.

Thank you.


Heres an image, UA is throwing a parsing error, so I uploaded the image to itch.io.

For the player moving behind the plane, you can change the Vector2.MoveTowards() to a value that is something like 5 ahead of the player, so the plane doesn’t move towards the plane but instead in front of it…
Code preview :

Vector2 Position = new Vector2(Player.transform.position.x, Player.transform.position.y +3f);

transform.position = Vector2.MoveTowards(transform.position, Position, Time.deltaTime):