Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Creating Health Variable + Functions to increase or decrease it | The Character Blueprint
Unreal Engine FPS Game
course content

Course Content

Unreal Engine FPS Game

Unreal Engine FPS Game

1. Unreal Engine Introduction
2. The Character Blueprint
3. Enemy Blueprints
4. Level Design and Aesthetics
5. User Interface and Sound Effects
6. Gameplay Logic
7. Packaging for Windows

bookCreating Health Variable + Functions to increase or decrease it

In this chapter, we will take a look at events BeginPlay and Tick, as well as functions and variables. Coupled with that we will implement the health of the character by creating a variable, and a function that we can call to reduce the health which resembles taking damage.

Variables are elements that hold information of a certain type. For instance, a variable of type Integer holds a whole number, and a variable of the type Boolean holds a true or false value.

To create a variable, click on the + sign in front of Variables in the left hand side panel called My Blueprint, give it a name and choose its type as shown in the video.

Events are instructions that we can call in run time to have our blueprint do something. The main two built-in events that we look at in this chapter are Event BeginPlay and Event Tick.

  • Event BeginPlay fires off as soon as the blueprint is spawned into the game while the game is running. Event BeginPlay fires off only once. To create a BeginPlay you can right click somewhere in the Event Graph that is not occupied and type in “BeginPlay” and choose Event BeginPlay.
  • Event Tick also fires off as soon as the game starts, but will continue firing off continuously. To create an Event Tick, right click in the graph and search for Tick and choose Event Tick.

Functions are similar to Events, they perform a set of instructions. There are some differences between Functions and Events.

Note

In functions, there is no concept of time, so nodes such as Delay do not exist in a function.

To create a function, click on the + sign in front of Functions in the My Blueprint panel.

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 2
We're sorry to hear that something went wrong. What happened?
some-alt