Book Image

Unreal Engine Game Development Cookbook

By : John P. Doran
Book Image

Unreal Engine Game Development Cookbook

By: John P. Doran

Overview of this book

Table of Contents (18 chapters)
Unreal Engine Game Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a Health/Damage system, part 2 – creating a healthbar


Something that you'll be using often as a game developer is some kind of healthbar. In this recipe, we will learn how to display a healthbar on the screen that will update based off of the values of variables inside of blueprints.

Getting ready

Before we start working on this, we need to have a project created and set up for our character. To do this, complete the Creating a Health/Damage system, part 1 – taking damage recipe in Chapter 8, Blueprint Scripting – Level Effects.

How to do it…

Let's see how we can use the UMG editor to display a healthbar:

  1. From the Content Browser tab, select the Content folder and then click on the Add New button and select New Folder. Name this new folder UI.

  2. Click on the Add New button once again and then go to User Interface | Widget Blueprint. When it comes up, name it HUD (short for Heads Up Display).

    The Widget Blueprint is a tool that can be used to place all of our UI elements into a scene.

    Note...