BatteryCollector #17 – Creating the HUD Blueprint

I am continuing the Battery Collector tutorial. This is the 17th video. Click here for the first part and here for the previous one.

Creating the HUD

BatteryHUD

In the Unreal Engine Editor, I am creating a Widget Blueprint and I am naming it BatteryHUD.

CreateWidgetBlueprint

In the UMG editor, I am adding a ProgressBar and set the anchor to the center. I am setting the PositionX to 0, PositionY to -100, SizeX to 600 and AlignmentX to 0.5.

AddProgressBar

In the Details panel of the ProgressBar, I am right-clicking on the Bind button next to the Percent value in the Progress section:

CreateBinding

In the new GetPercent blueprint, I am adding a GetPlayerCharacter node and cast it to a BatteryCollectorCharacter. I convert this last node to a pure cast by Right-Clicking on it:

ConvertToPureCast

 

I get the CurrentPower of the CharacterPlayer and divide it by the PowerToWin of the Game mode to define the value to return:

GetPercent

GameMode_BP

I am now creating a new blueprint based on BatteryCollectorGameMode:

GameMode_BP

I am naming it GameMode_BP. I am opening this blueprint and in the Details panel, I set the HUDWidgetClass to BatteryHUD:

GameMode_BP_HUDWidgetClass

Project Settings

In the Project Settings, I am now changing the default Game Mode to GameMode_BP:

ProjectSettings

When I play, I can now see the progress bar:
PlayProgressBar

Next Step

Next, I will set up the play states

About

Gamer

Tagged with:

Leave a Reply