Skip to content

Menus and HUD

A scene menu is a vertical list navigated with uiUp/uiDown/uiConfirm (keyboard, gamepad) or the mouse (uiClick); back runs on uiBack. Labels can show bindings.

{
"anchor": "center",
"items": [
{ "label": "PLAY", "do": [{ "action": "goToScene", "scene": "level-1" }] },
{ "label": "SOUND: {settings.sound}", "do": [{ "action": "toggleSetting", "setting": "sound" }] }
],
"back": [{ "action": "popScene" }]
}

HUD widgets: text, counter, icon (sprite + value), hearts (full/empty frames up to max), bar, timer.

[
{ "widget": "hearts", "anchor": "top-left", "bind": "player.Health.hp", "max": "player.Health.max", "icon": "ui.icons", "frames": [0, 1] },
{ "widget": "icon", "anchor": "top-right", "icon": "ui.icons", "frames": [2], "bind": "game.coins", "label": "{value}/{game.coinTotal}" },
{ "widget": "timer", "anchor": "top", "label": "TIME " }
]

A pause menu is an overlay scene opened with { "on": "input:pause", "do": [{ "action": "pushScene", "scene": "pause" }] }; the scene below freezes until popScene.