Creating the enemy character
Creating the enemy character is similar to creating the player character. First, we create the AEnemy
class, which inherits from ACharacter
. Second, we create the BP_Enemy
blueprint, with AEnemy
as the parent class. Third, we create the ABP_Enemy
animation blueprint, which is identical to ABP_PlayerAvatar
.
The main difference between the enemy and player characters is the controller. The EnemyController
class inherits from the engine’s AIController
and will make decisions to move to the target and attack.
The enemy will share the hero’s model and animations, so to distinguish between the two, enemy models will use a gray material, which puts all the enemies in gray (see Figure 7.5):
Figure 7.5 – The hero versus an enemy
Before we start, we want to clarify that we will apply some iterative processes in the development of the game. While creating the enemy character, we will copy some code and borrow...