Setting a gameplay win condition
We will modify our HUD Blueprint and player character Blueprint to account for a target goal that the player must strive to achieve. We will display the target goal in the HUD next to the target count, so the player can easily see how many targets need to be destroyed to reach their goal.
We will also create another Widget Blueprint representing a win menu screen that will be shown to the player when they reach their goal. Finally, we will implement the logic needed to check whether the player has won and to show the win menu screen.
Displaying a target goal in the HUD
First, we need to create a variable in the FirstPersonCharacter Blueprint that will establish how many targets we are asking the player to destroy to win the game. Then, we need to display this information to the player in the HUD Blueprint.
Follow these steps to display the target goal:
- In the Content Browser, access the
/Content/FirstPersonBP/Blueprints
folder and...