Making Enemies That Try And Dodge The Player’s Attacks

Adam Reed
May 6, 2021

--

In a lot of games, you will encounter enemy AI that detects the player’s actions and tries to counter them. In Halo if you throw a grenade, the Elite enemy type will attempt to dive out of the way in order to avoid taking damage. So what would that logic look like?

In order for an enemy to react, they will need some sort of trigger to react to. In this case, I am using the same colliders that I used/addressed in a previous article for enemies to detect powerups that are in front of them. I then just added an alternative method that is called in Update instead of the regular movement calculations if a laser is detected in front of them.

--

--

Adam Reed
Adam Reed

Written by Adam Reed

Hi, my name is Adam Reed and I am a software engineer specializing in Unity and C# development. Feel free to scroll through and check out some of my work!

No responses yet