Class: Hud

Class contents

Methods list

These are special functions (or methods) that you may call on the object. these functions typically instruct the object to perform a certain operation.

Events list

Events are functions you add to your objects, that will be called by Cubiverse when certain things (events) occur.
    No events

Class Information

Constructor

new Hud()

You should not instigate this class, therefore never perform the "var myHUD = new Hud()", simply use the global "HUD" variable in place of "myHUD" Also, check out the Wiki for more information on Hud Object
Important:
  • <span style="color : orange; font-weight : bold">STATIC OBJECT</span> - You do not need to instigate or create this class, it is available through the <span style="color : blue; font-weight : bold">HUD</span> variable, see the Wiki for more information on Hud Object and HUD variable

Methods

displayText(left, top, text, size, displayMode, duration) → {HudComponent}

Displays a string of text to all connected players in the world

This method is useful is you wish to display information at the start of a world (i.e. on world join, or reset) telling players to "Get Ready", or giving them basic guidance on how to play in your world.

Parameters:
Name Type Description
left float The percentage left position of text (css percentage)
top float The percentage top position of text (css percentage)
text string The text you which to display, ONLY alphanumeric characters are supported AND - , . ! [ ]
size float The size (in percentage) of the font
displayMode enum Specifies how to text will be displayed on screen
duration integer The length of time (in milliseconds) of how long the HUD object should appear on screen

hudTextDisplayMode.immediate - [DEFAULT] Text will instanty appear and disappear on screen

hudTextDisplayMode.typewriter - Text will typewrite onto the screen (5 character second) and fade out afterwards

hudComponent Returns a instance to a hud component
Returns:
Returns a instance to a hud component, you should use this object if you wish to manage the text generated
Type
HudComponent
Example
HUD.displayText( 10, 15, "Welcome to my Hello World", hudTextDisplayMode.typewriter, 15000 ) ;

displayTextCenter(top, text, size, displayMode, duration) → {HudComponent}

Displays a string of text that is center in the view port to all connected players in the world

This method is useful is you wish to display information to any players to "Get Ready", or giving them basic guidance on how to play in your world.

Parameters:
Name Type Description
top float The percentage top position of text (css percentage)
text string The text you which to display, ONLY alphanumeric characters are supported AND - , . ! [ ]
size float The size (in percentage) of the font
displayMode enum Specifies how to text will be displayed on screen
duration integer The length of time (in milliseconds) of how long the HUD object should appear on screen

hudTextDisplayMode.immediate - [DEFAULT] Text will instanty appear and disappear on screen

hudTextDisplayMode.typewriter - Text will typewrite onto the screen (5 character second) and fade out afterwards

hudComponent Returns a instance to a hud component
Returns:
Returns a instance to a hud component, you should use this object if you wish to manage the text generated
Type
HudComponent
Example
HUD.displayTextCenter( 15, "Welcome to my Hello World", 100, hudTextDisplayMode.typewriter, 10000) ;