ENEMY AI IN SCORPION ENGINE PART 2

In this iteration of the AI I have improved the enemies ability to approach and also change sides correctly.

In this video you will see the enemy now tries to position themselves correctly on the Y axis as a priority, if they are too close on the X but too far away on the Y then they make diagonal movements around the player before trying to position themselves for an attack.

Apart from a slight animation bug when moving diagonally this looks really nice and almost completes this part of the AI which I call the “Engage” state. The last thing to do for this state would be to ensure they consider if an enemy is already attacking from one side, so they would choose the other.

In addition to this “Engage” state, next we will compliment it with a “Patrol” state. In the “Patrol” state the enemy will be coded to keep a distance and make less movements, possibly changing sides.

It’s likely this “Patrol” state will only be used if 2 enemies are already engaged with a player.

We can track this by giving the Player “slots”, if front and back slots are filled then the enemy can remain in “Patrol”, if a slot becomes free then they will switch to “Engage”.