ui.createImage

Section: UI (HUD)

What it does

ui.createImage creates a Image in ui. It takes id, src and an options object.

Signature

ui.createImage(id, src, { x, y, width, height, anchor })

Arguments

  • id
  • src
  • { x, y, width, height, anchor }

    Keys:xywidthheightanchor

Example · generated

function start() {  ui.createImage('image', '/ui/icon.png', { x: 100, y: 120, width: 2 });}

ui.createImage 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