Tutorial 5 – Creating the Enemies

In Unreal Engine, creating enemies is an exciting way to bring your game to life. This tutorial will guide you through setting up an enemy character that can move, detect the player, and perform simple actions.

Start by creating a new Blueprint Class. Choose “Character” as the parent class because it includes built-in movement and animation functionality. Name it “Enemy_BP.”

Open the Blueprint and add components to define the enemy’s appearance and behavior. Start by adding a “Static Mesh” or “Skeletal Mesh” component for the enemy’s visual model. Choose a pre-made mesh from the Content Browser or import your own. Adjust its position and scale as needed.

Next, add a “Capsule Component” around the enemy to handle collisions. This ensures the enemy can detect obstacles or interactions. Adjust the size of the capsule to fit around the enemy’s mesh.

To make the enemy move, open the Event Graph. Add a “Begin Play” event to initialize the enemy’s behavior. Use the “AI Move To” node to make the enemy move to a specific target. For example, place a target actor in the level and set it as the destination. You can repeat this action using a loop or randomize the target to create patrol behavior.

To detect the player, add a “Pawn Sensing” component to the Blueprint. In the Details panel, enable sensing features like “Sight” and set the sensing range and angle. Use the “On See Pawn” event to trigger actions when the player enters the enemy’s vision. For instance, you can make the enemy chase the player using another “AI Move To” node.

Add logic for the enemy to perform actions when close to the player. For example, use a “Box Collision” component around the enemy’s attack area. Add an “On Component Begin Overlap” event to trigger damage or animations when the player enters the box.

Enhance the enemy by adding variables like health. Create a “Health” variable and reduce its value when the player attacks the enemy. Use a “Branch” node to check if the health reaches zero, and trigger a “Destroy Actor” node to remove the enemy from the game.

Finally, test the enemy by placing instances of “Enemy_BP” in your level. Play the game to see if they move, detect the player, and perform their actions correctly. Adjust settings like speed, sensing range, and attack damage to balance the gameplay.

This setup creates a basic enemy with movement, player detection, and actions. You can expand its behavior further by adding animations, sounds, or advanced AI logic.

enemies
Tutorial 4 – Building the Elevator Platform
Tutorial 6 – Creating a Rotating Door

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?