Shape Insurrection – Basic enemy AI

So now I have pretty much completed the base of my enemy AI for one unit type. I was trying to find something to model it on and played some Zelda to see how the melee units react to players. For the moment my enemy AI has 3 states which change how they move. When patrolling they follow way-points and ignore the player entirely. If the player moves into a cone in front of the enemy they begin engaging, in this state they move towards the player slowly until they reach a set distance. At this distance they start attacking and charge rapidly at the player forcing them back, after an attack they begin engaging again. If the player moves out of their attack cone they return to their patrol.

Colliders for vision and impact

Colliders for vision and impact

Update function from enemycontroller class.

Update function from enemycontroller class.

Additional functions from enemycontroller

Additional functions from enemycontroller

Additional code from the playercontroller

Additional code from the playercontroller

The code from playercontroller reacts to the hit forcing the player back and then removing the remaining velocity. Next I will work on getting the enemy AI to act differently with the lights on and allow the player to attack them back.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s