2D top down airplane enemy pointers.

Hello,

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 have tried making the enemy aim in front of the player but, it resulted in, the player flying strait at the enemy and the enemy turning around and running.

Thank you.

There’s so many different ways to do this stuff, you kinda have to experiment.

Here’s one approach:

  • have your enemy always move the way he is facing, but only change directions once every second or so. This lets him be subtly wrong and gives the player a random chance to get into position.

Another way:

  • have waypoints around your level, the enemies alternate between “go towards random waypoint” and “go towards player”, which can give them a very irregular behavior.

Mix and match and fiddle with timing, speeds, etc., and with just a few super-simple combinations, you can get some pretty fun enemy behavior.

Thank you,

I’ll try those.