Trap, Health and Damage System

HUD, Menus


Create a UI folder in My Asset folder
R click, use interface, Widget BP → name as Pause
Duplicate the BP, rename as MainMenu
Change PlayerUI from thridperson to P0 UI, place in my Asset, Player folder

Go to Player0 BP, create node “keyboard P”, Construct None created by type “create widget”, class change to Pause
image.png


Design the menu:


Open Pause Widget,
Drag Canvas box, and then Text in the graph, set Canvas box Anchors in the top middle
image.png

Type PAUSED in text block, tick size to Content, justification in the middle
Size to 100, color to red
Place the text in top middle
image.png
Drag Button and name as Unpause, sublayer drag a Text underneath, name as Unpause too
image.png
extend the button size to fit the text
image.png

Duplicate the Unpause button, rename as MainMenu
Set both button anchors in the middle, drag both button parallel to anchor ,change the 2nd button as main menu:
image.png

Activate Pause function by hitting P:


Click Graph next to Designer tab in top R corner
Delete event trick and event pre construct, make nodes as below:
Type “Set Show Mouse Cursor”
image.png

Activate Unpause and main menu button:


Click on Unpause variable at left, click On Clicked in Events (On click unpaused node is formed)
image.png
Duplicate the nodes above to connect to On click (unpaused) node, but untick paused and show mouse cursor
image.png
Continue the nodes behind as:
image.png

Create and activate Main Menu:


In My assets folder, create a new folder name as Levels → Move maps and builddata map in thirdperson Map folder into the new Levels created
image.png
R click, Level, name the new level as MainMenu

Back to Pause UI, this time on MainMenu variable, On Click (MainMenu), connect with Open Level node:
image.png

Screen cap a viewport for the main menu (go to immersive mode, turn off game mode)
image.png

Drag the screen cap shot in UI folder,
Go to MainMenu Widget, drag canvas panel and image in graph,
For image tab, select Brush, choose the screen cap
image.png
Anchor choose as entire screen, then offset left, top, right, bottom all to 0
image.png
Add background blur in canvas panel, anchor same as above, set blur strength to 4
image.png
Add also a new button name as Play, and then a text, type as Play Game
image.png

Go to Graph of main menu, delete all default nodes, create On Clicked from variable “Play”
image.png
Go to Level folder, open MainMenu Level Map → Open Level BP
image.png
image.png
In the graph, type create widget node, then choose class to mainmenu → type ”Set show mouse cursor”
image.png

Create End State:


Go to UI folder, duplicate Pause Widget, rename as EndState
Open up, change PAUSED to DEFEAT, Unpause to Retry
image.png
Go to Graph, change the On Clicked (Retry) nodes as follow:
image.png

Go to Player BP, event any damage node, add create widget at the end
image.png

Add a delay for main menu shows up after die:
image.png

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.