Game logic - Custom HUD – Ylands
Lou Montana (talk | contribs) m (Text replacement - " (\=+)([a-zA-Z0-9][^ ]+[a-zA-Z0-9])(\=+) " to " $1 $2 $3 ") |
Lou Montana (talk | contribs) m (Text replacement - "{{DEFAULTSORT:{{#sub:{{PAGENAME}}|19}}}}" to "{{DEFAULTSORT:{{#sub:{{PAGENAME}}|13}}}}") |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=Overview= | =Overview= | ||
'''Custom HUD''' game logic provides a way of displaying additional custom information on the screen of the player, such as healthbars, timers, custom minimaps etc. It is possible to create and activate multiple overlaying Custom HUD layouts. | '''Custom HUD''' game logic provides a way of displaying additional custom information on the screen of the player, such as healthbars, timers, custom minimaps etc. It is possible to create and activate multiple overlaying Custom HUD layouts. | ||
This game logic shares a layout editor with '''[[ | This game logic shares a layout editor with '''[[Ylands:Game_logic_-_Custom_window|Custom Window]]''' game logic and the details on how to operate can be found on it's own separate page: | ||
'''[[Ylands Custom UI - Edit layout|Edit layout]]''' | '''[[Ylands:Custom UI - Edit layout|Edit layout]]''' | ||
= Activating the Custom HUD = | = Activating the Custom HUD = | ||
Line 11: | Line 11: | ||
== Principles == | == Principles == | ||
The layout of Custom HUD consists of '''Widgets''' and it is through modification of their properties the scripting works. | The layout of Custom HUD consists of '''Widgets''' and it is through modification of their properties the scripting works. | ||
You can view the list o related scripting tiles by switching to '''Advanced''' directory and then navigating to '''Game Logic - Custom UI''' or by searching the keyword '''Widget''' in the search bar. If you plan on accessing these in more places, it makes sense to store the widget inside a variable so that you could later access it in a more convenient way. In case of multiplayer games, consider storing these variables in an '''[[ | You can view the list o related scripting tiles by switching to '''Advanced''' directory and then navigating to '''Game Logic - Custom UI''' or by searching the keyword '''Widget''' in the search bar. If you plan on accessing these in more places, it makes sense to store the widget inside a variable so that you could later access it in a more convenient way. In case of multiplayer games, consider storing these variables in an '''[[Ylands:Game_logic_-_Entity_storage|Entity storage]]''' as the variables stored in '''Custom HUD''' itself are shared by all players. | ||
<gallery> | <gallery> | ||
Line 18: | Line 18: | ||
== Optimization == | == Optimization == | ||
While it might be tempting to update the widgets using the '''[[ | While it might be tempting to update the widgets using the '''[[Ylands:Game_logic_-_Time_trigger|Time Trigger]]''', it is much more efficient to utilize other Game Logics, such as '''[[Ylands:Game_logic_-_Trigger_zone|Trigger zone]]''' or '''[[Ylands:Game_logic_-_Event_listener|Event listener]]''' when possible. | ||
== Example == | == Example == | ||
An example scenario '''[[ | An example scenario '''[[Ylands:Tutorial_-_User_interface|User Interface]]''' exists in the game, which can be found in '''Editor - Create game - Examples menu'''. | ||
---- | ---- | ||
{{Navbox/Ylands}} | {{Navbox/Ylands}} | ||
{{DEFAULTSORT:{{#sub:{{PAGENAME}}| | {{DEFAULTSORT:{{#sub:{{PAGENAME}}|13}}}} | ||
[[Category: Game Logic]] | [[Category: Game Logic]] | ||
[[Category: Ylands 0.14]] | [[Category: Ylands 0.14]] |
Latest revision as of 14:21, 24 November 2023
Overview
Custom HUD game logic provides a way of displaying additional custom information on the screen of the player, such as healthbars, timers, custom minimaps etc. It is possible to create and activate multiple overlaying Custom HUD layouts. This game logic shares a layout editor with Custom Window game logic and the details on how to operate can be found on it's own separate page:
Activating the Custom HUD
Custom HUD can be set to be activated at the start of the game by checking the Visible to new players box in the properties window and it can be activated or deactivated via the visual scripting using the Show Custom Hud tile.
Scripting Custom HUD
Principles
The layout of Custom HUD consists of Widgets and it is through modification of their properties the scripting works. You can view the list o related scripting tiles by switching to Advanced directory and then navigating to Game Logic - Custom UI or by searching the keyword Widget in the search bar. If you plan on accessing these in more places, it makes sense to store the widget inside a variable so that you could later access it in a more convenient way. In case of multiplayer games, consider storing these variables in an Entity storage as the variables stored in Custom HUD itself are shared by all players.
Optimization
While it might be tempting to update the widgets using the Time Trigger, it is much more efficient to utilize other Game Logics, such as Trigger zone or Event listener when possible.
Example
An example scenario User Interface exists in the game, which can be found in Editor - Create game - Examples menu.