Adding Enemies
Last updated
Last updated
Refer to this tutorial for instructions on adding . This section of the documentation will cover the same steps in detail.
In FPS Engine you can make simple enemies or advanced / complex enemies. The procedure is very simple for both, so let´s get into it:
If you want an object to be an Enemy in FPS Engine, you will need this object to have a collider. Then, attach EnemyHealth.cs to it, and modify the parameters as you like. Finally, add the “Enemy” tag and the “Enemy” layer.
If you have no missing references on EnemyHealth component, you should now be able to damage your enemy!
Sometimes, you might be working on an enemy that can receive headshots or requires different collisions for various body parts. FPS Engine supports advanced enemies like these!
First, create an object to act as the parent of the enemy. Attach the EnemyHealth component to this object and configure the parameters as desired. Inside this parent object, place your models and set up the collisions. There are two types of collisions: BodyShots and CriticalShots/HeadShots.
Your body shot collision will need to have the “Enemy” layer assigned, and the “BodyShot” tag assigned, as well as a collider.
Your head shot collision will need to have the “Enemy” layer assigned, and the “Critical” tag assigned, as well as a collider.
Just like this, you are ready to damage your enemies and deal damage depending on the hit zone.