Enemy AI Attacking


Author: Austin Anderson
Posted on: 10/13/23
For the system build, one of the requirements was to have a game loop. Obviously, to complete a game loop, the enemies would have to be able to attack the player, so my "problems" arose as I was implementing the enemy. The following issues occurred: The enemy needed to move towards the player, the enemy needed to attack the player, the enemy needed to take damage, and the enemy needed to die. These were all relatively easy to figure out which is why I am talking about all of them rather than one specific problem. 

The first issue was the enemy needed to move towards the player. I initially set this up in the enemy blueprint and called the AIMoveTo function, but I soon realized that the enemy would need a state machine and reimplemented it in the AI state machine. Next, the enemy needed to attack the player. Since the enemy did not have a weapon, I had to give it collision boxes on its hands. Once I had these set up in place on the hands, I needed to find and implement an attack animation. The current attack animation does not make sense and is a placeholder for later attacks. After that, the enemy needed to take damage, so I set up a health component for all things that take damage and made sure that whenever the player shoots the enemy, it would do damage towards the enemy's health. Finally, the enemy needed to die. I set up an "OnDeath" delegate that gets fired once the enemy's health is 0. This stops the enemy in its tracks, plays the death animation, and disables the enemies collisions.

Overall I had many issues arise, but I was not stuck on any of them for an extended amount of time. It has been a satisfying build so far and I am enjoying the AI side of the build.

Get Cyber Siege

Leave a comment

Log in with itch.io to leave a comment.