Since we already have a bunch of interactions in our game, it’s time to let our player know when he can interact with something.
We can do this using an Interaction type HUD. Those kind of HUDs will be displayed when the player can interact with something – you can even display different HUDs based on the type of the interaction (e.g. if it’s a Scene Changer, an Item Collector or a custom type).
A new GUI box
Open the ORK Framework editor and navigate to Menus > GUI Boxes. Select the Player HUD box and copy it. Change the following settings in the new HUD.
Set to Interaction HUD.
Content Box Settings
Set to X=640, Y=450, W=240, H=50.
Select Middle Center.
Open Box Behaviour > Move Settings
- Start Position
Set to X=540, Y=450.
Close Box Behaviour > Move Settings
- End Position
Set to X=740, Y=450.
That’s it for the GUI box.
The new HUD
Navigate to Menus > HUDs, add a new HUD and change the following settings.
Set to Interaction.
- GUI Box
Select Interaction HUD.
- HUD Type
An Interaction type HUD doesn’t have the Game Mode settings like other HUDs, because it’ll only be displayed when the player can actively interact with something – but instead, you can define which type of interaction the HUD will be displayed for. We’ll create a simple interaction HUD, so it’ll be displayed for all kinds of interactions.
- Any Interactions
Enable this setting.
The HUD will be displayed for all available interactions and ignore the type.
- Interact on Click
Disable this setting.
If enabled, the player can interact with an available interaction by clicking on the HUD.
Click on Add Interaction Element to add a HUD element.
Set to: Interact
- Text Alignment
- Text Color
- Font Size
Set to 25.
- Font Style
Select Bold And Italic.
Set to X=0, Y=0, W=220, H=100.
And that’s it for the HUD – click on Save Settings and close the ORK Framework editor.
Open the main menu scene (0 Main Menu) and hit play.
Approach something that’s interactable, like an NPC or an item – the new HUD will appear as soon as the player can interact with it, and disappear when he can’t.
And that’s it for now – the next lesson will cover creating a cinematic event.