AGGRESSIVE state

Before we started programming, we defined how many states we would need for this enemy AI, and we chose three different states: PASSIVE, DEFENSIVE, and AGGRESSIVE. Now that we already have the two behavior states in place (passive and defensive), there is just one more needed to complete our enemy AI, that is, to protect the building.

We previously decided that the character would only directly confront the player if he couldn't use the wall as cover, and that moment is where the player comes from the left and the enemy is surprised with its presence.

Once again, we need to first check if the player triggered the left area, ...

Get Practical Game AI Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.