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

Dynamic enemy healthbars


Another thing that you'll often see in games are healthbars for enemies that will appear over their heads, changing as the game is being played. In this recipe, we will learn how we can do what we've learned from the previous recipe and apply it here.

Getting ready

Before we start working on this, we need to have a project created and set up. Do the previous recipe all the way to completion.

How to do it…

Of course, to actually have enemy healthbars, we will need to actually have an enemy, so let's get that implemented first:

  1. Go to the Content Browser tab and then to the ThirdPersonBP/Blueprints folder. Right-click on the ThirdPersonCharacter object and then select Duplicate and name the duplicated object AI.

  2. Double-click on the blueprint to open up its EventGraph. We actually don't need any of the previously-created stuff in Event Graph, so select all of the Unreal-created content and then delete it. Do note that we do have the CurrentHealth and MaxHealth properties and...