Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Unreal Engine 4 Game Development Essentials

You're reading from   Unreal Engine 4 Game Development Essentials Master the basics of Unreal Engine 4 to build stunning video games

Arrow left icon
Product type Paperback
Published in Feb 2016
Publisher
ISBN-13 9781784391966
Length 266 pages
Edition 1st Edition
Tools
Arrow right icon
Authors (2):
Arrow left icon
Satheesh P.V Satheesh P.V
Author Profile Icon Satheesh P.V
Satheesh P.V
Satheesh PV Satheesh PV
Author Profile Icon Satheesh PV
Satheesh PV
Arrow right icon
View More author details
Toc

C++ to Blueprint


We now have a health and health regeneration system in our character class. One problem with our current system is that we have not yet defined what happens to our character after the health reaches 0. In this section, we will create an event that we will implement in Blueprint. This event will be called when the player's health reaches 0.0. To create this Blueprint event, open our character header file and add the following code:

UFUNCTION(BlueprintImplementableEvent, Category = "My Character")
void PlayerHealthIsZero();

As you can see, we added a normal function called PlayerHealthIsZero(). To make this available in Blueprint, we added a UFUNCTION specifier and inside that we added BlueprintImplementableEvent. This means C++ can call this function and it will execute inside Blueprint but we cannot add a definition for this in our character source file. Instead, we will just call it inside the source file whenever we want. In this example, we will call it inside our TakeDamage...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime