The UI system allows you to create buttons, text, images, progress bars and input fields directly on top of the game. UI elements are always drawn on a layer above the scene and can react to clicks, keys, or custom events. Even though UI elements are always visible above the scene, they are still managed inside the editorβs layer system.
getObjectByName() and modify their properties from your scripts.
UI buttons react to _onClickDown and _onClickUp events.
You can use them to open menus, load scenes or execute any action.
function Start(obj) {
const boton = getObjectByName("BtnIniciar");
boton._onClickUp = () => {
PlaySound("click.mp3");
LoadSceneByName("MainScene");
};
}
boton.text = "Start Game";
boton.color = "#00bcd4";
boton.visible = true;
boton.active = true;
UILabel elements show static or dynamic text.
You can update them in real time from Update().
function Update(obj, dt) {
const label = getObjectByName("ScoreText");
label.text = "Score: " + currentScore;
}
text: displayed content.color: text or background color depending on configuration.visible: show/hide the label.
Allows the player to type text directly from the keyboard.
When the user clicks the field, it gains focus (focused = true) and starts receiving input.
function Start(obj) {
const campo = getObjectByName("InputNombre");
campo.text = "Enter your name...";
campo.color = "#ffffff";
campo.focused = true;
}
function Update(obj, dt) {
const campo = getObjectByName("InputNombre");
if (campo.focused) {
console.log("Typing:", campo.text);
}
}
focused = false).function Start(obj) {
const campo = getObjectByName("InputNombre");
const boton = getObjectByName("BtnAceptar");
boton._onClickUp = () => {
PlaySound("confirm.mp3");
console.log("π€ Entered name:", campo.text);
};
}
Displays an image inside the HUD, ideal for icons, logos or decorative UI elements.
function Start(obj) {
const icono = getObjectByName("IconVida");
icono.visible = true;
icono.w = 64;
icono.h = 64;
icono.x = 20;
icono.y = 20;
}
The UIProgressBar visually shows a value between 0 and 1, useful for health, energy, loading or download progress. You can customize its color, background, border and percentage text.
function Update(obj, dt) {
const vida = getObjectByName("HealthBar");
vida.value = player.hp / player.maxHp;
}
value: current value (0 to 1).color: bar color.background: background color.borderColor: outer border color.showText: show percentage if true.font: percentage text font.textColor: percentage text color.function Update(obj, dt) {
const bar = getObjectByName("LoadingBar");
bar.value += dt * 0.1;
if (bar.value > 1) bar.value = 1;
if (bar.value < 0.5) bar.color = "#ff4444";
else bar.color = "#00cc44";
}
x, y: screen position.w, h: width and height.color: background or text color.text: text content (UILabel, UIButton, UIInputField).image: assigned image file (UIImage).visible: whether it is rendered.active: whether it can receive interaction.You can enable or disable UI elements the same way as any other object:
const menu = getObjectByName("MainMenu");
menu.visible = false; // Hide
menu.active = false; // Disable interaction
Update().PlaySound() to improve feedback.getObjectByName()._onClickDown and _onClickUp handle user interaction.UIInputField supports typing, deletion and automatic focus loss.UIProgressBar represents real-time values (health, loading, etc.).