The engine includes a lightweight toast system for floating messages that can
be displayed on screen for notifications, player warnings, or real-time debugging.
Unlike alert(), toasts are non-blocking, appear elegantly,
and allow full customization of color, size, and position.
showToast(
message,
type = "info",
duration = 2500,
bgColor = null,
textColor = null,
fontSize = null,
top = "20px",
left = "50%"
)
"info", "success", "error", "warning").2500)."16px")."20px")."50%").// Info message
showToast("âšī¸ Loading data...", "info");
// Success (green)
showToast("â
Saved successfully", "success");
// Error (red)
showToast("â Error connecting to server", "error");
// Warning (yellow)
showToast("â ī¸ Low energy", "warning");
// Purple background, white text, large font
showToast("đĨ Power-Up activated!", "info", 3000, "#6f42c1", "#fff", "20px");
// Black background, green terminal-like text
showToast("Debug: variable = 42", "info", 2000, "#000", "#0f0", "13px");
// Translucent background with red text
showToast("Stealth mode active", "info", 2500, "rgba(0,0,0,0.7)", "#ff5555", "18px");
// Top-left corner
showToast("đĻ Item picked up", "success", 2000, null, null, null, "20px", "10%");
// Top-right corner
showToast("đ You've earned 100 coins", "success", 3000, null, null, null, "20px", "90%");
// Center of the screen
showToast("đ¯ New high score!", "info", 3000, "#333", "#fff", "22px", "50%", "50%");
// Bottom
showToast("đŦ Message received", "info", 4000, "#004aad", "#fff", "16px", "90%", "50%");
function Start(obj) {
showToast("đ Scene started", "success");
}
function Update(obj, dt) {
if (IsJustPressed("t")) {
showToast("You pressed T", "warning");
}
}
You can now display several messages at the same time, each with its own duration, position and style. They do not overwrite each other.
// Multiple active toasts
showToast("â
Scene saved", "success");
showToast("đž Autosave complete", "info", 3000, "#222", "#0ff", "14px", "60px");
showToast("đĨ Critical error", "error", 4000, "#900", "#fff", "16px", "100px");
// Script: notify_item_pickup.js
function OnTriggerEnter(obj, other) {
if (other.name === "Player") {
showToast("đ You obtained a golden key", "success", 3500, "#2ecc71", "#fff", "18px", "40px", "50%");
}
}
// Script: debug_alert.js
function Update(obj, dt) {
if (IsJustPressed("d")) {
showToast("Debug enabled", "info", 2000, "#000", "#0f0", "14px", "80px", "20%");
}
}
showToast().