How to make a 2.5D Platformer in Unreal Engine 5 - Beginner Tutorial
Table of Contents
Introduction
In this tutorial, you'll learn how to create a 2.5D platformer using Unreal Engine 5. This guide will walk you through the essential steps, including restricting character movement, adjusting camera views, and creating a simple enemy mechanic. By the end, you'll have a solid foundation to start building your own platforming experience.
Chapter 1: Setting Up Your Project
-
Create a New Project
- Open Unreal Engine 5.
- Select the Third Person template.
- Set the project type to Blueprint.
-
Understanding Axis Directions
- Click on the player start in your map to show the arrow Gizmo.
- Note the axis colors:
- Red = X-axis (main movement)
- Blue = Z-axis (jumping/falling)
- Green = Y-axis (not used in our game)
-
Accessing the Character Blueprint
- Open the Content Drawer.
- Navigate to Third Person Blueprint.
- Open the Third Person Character Blueprint.
Chapter 2: Adjusting the Camera and Movement
-
Rotate the Camera
- Press the E key to enter rotate mode.
- Uncheck "Use Pawn Control Rotation" in the camera settings.
- Rotate the camera to view the character from the right side.
-
Restrict Character Movement
- Open the Event Graph in the character blueprint.
- Delete the nodes for forward/backward movement.
- Move the left/right movement node upwards to connect with existing nodes.
-
Fixing Camera Rotation
- Select the camera boom and set its rotation to "World" to maintain its position while the character turns.
- Rotate the player's spawn by 180 degrees for proper orientation.
-
Adjust Turning Speed
- In the Character Movement Component, find the rotation rate settings.
- Change the Z value from 500 to 720 for faster turning.
Chapter 3: Adjusting Character Movement Properties
-
Constrain Character Movement
- In the Character Movement Component, check "Constraint to Plane."
- Set Y to 1.0 to prevent forwards/backwards movement.
-
Modify Character Dynamics
- Adjust Gravity Scale to 3.0 for a responsive feel.
- Set Jump Z Velocity to 1200 for improved jump height.
- Change Max Walk Speed to 800 for faster movement.
Chapter 4: Creating a Platformer Camera Manager
-
Create Camera Manager Blueprint
- Create a new blueprint of type Actor called
BP_CameraManager
. - In the Character Blueprint, cut the camera boom and camera components.
- Paste them into the Camera Manager Blueprint.
- Create a new blueprint of type Actor called
-
Set Up Camera Following Logic
- Create a variable called
Follow Target
of type Character Object, set it as editable and expose it on spawn. - In the Character Blueprint, add the Begin Play event and call "Spawn Actor" using
BP_CameraManager
.
- Create a variable called
-
Implement Camera Update Function
- Create a function named
Update Camera Position
. - Use
Set Actor Location
with an Interp to smoothly follow the player. - Call this function every frame from the tick event.
- Create a function named
-
Prevent Camera from Moving Up and Down
- Split the target location in
Update Camera Position
. - Keep the camera's Z position static to prevent vertical movement.
- Split the target location in
-
Add Camera Offset
- Use an
Add
node to combine the forward vector of the character with an offset for improved gameplay aesthetics.
- Use an
Chapter 5: Creating a Simple Enemy
-
Create Enemy Blueprint
- Create a new blueprint of type Character called
BP_Enemy
. - Add a sphere mesh and set its material to red.
- Update the capsule size to fit the sphere.
- Create a new blueprint of type Character called
-
Implement Enemy Movement
- In the Tick event, add movement input with a direction of 1.0 on the X-axis.
- Set the Max Walk Speed in the Character Movement Component to 30 for slow movement.
-
Prevent Enemy from Being Pushed Off Path
- Enable "Constraint to Plane" and set Y to 1.0 in the enemy's Character Movement Component.
-
Detect Player Collision
- In the Player Blueprint, override the
On Landed
event. - Cast to
BP_Enemy
, destroy the enemy, and useLaunch Character
to give a bounce effect.
- In the Player Blueprint, override the
Conclusion
You have successfully set up a basic 2.5D platformer in Unreal Engine 5, complete with character movement mechanics, camera adjustments, and simple enemy interactions. From here, you can expand your game by adding more levels, refining mechanics, and incorporating additional gameplay features. Explore free assets and experiment with different designs to enhance your platformer experience!