ui.createText

Section: UI (HUD)

What it does

ui.createText creates a Text in ui. It takes id, text and an options object.

Signature

ui.createText(id, text, { x, y, fontSize, color, anchor })

Arguments

  • id
  • text
  • { x, y, fontSize, color, anchor }

    Keys:xyfontSizecoloranchor

Example · generated

function start() {  ui.createText('text', 'Hello', { x: 100, y: 120, fontSize: 24 });}

ui.createText is called with values of the shape its signature asks for. The code sits in start(), which the engine calls once, when the entity spawns.

13 members in ui