Realot StudioDocs
API reference

Runtime modules and global API

These runtime globals are passed into every gameplay script. Use this page as the entry point, then follow the detailed guides for exact behavior and options.

View as Markdownllms.txt

#Entity lookup functions

findFirst(name), findAll(name), findFirstWithTag(tag), findAllWithTag(tag), findWithTag(tag), findById(id) and findInRadius(x, y, radius, opts?) locate entities in the current scene.

#Scene, physics and navigation

ObjectExposed surface
sceneEntity lookup; load, restart, pause, resume; read-only current and isPaused; scene-wide lighting.
physicsraycast(x1, y1, x2, y2, opts?), layer(...indices).
navfindPath, isWalkable, bake, areaIndex, areaMask, areaCosts.

#Input, time and math

ObjectExposed surface
inputkeyDown(key), keyPressed(key).
mouseWorld/screen coordinates, cursor state, button state, isOver, clickedOn.
touchActive touch list, per-touch positions and state, swipe/pinch helpers, isOver, tappedOn.
timedeltaTime, unscaledDeltaTime, elapsed, scale.
randomint(min, max), float(min, max).
mathxlerp, smoothstep, clamp, moveToward, remap, approximately.
smoothstep(a, b, value)Global smoothstep helper also available without mathx..

#Game services

Object / functionPurpose
globalShared in-memory key/value state between scripts during the running game.
savePersistent key/value data and named save slots backed by IndexedDB; exact members are in SaveAPI.
debugPlay-window diagnostic HUD, FPS line and custom values.
poolNamed object pools for reusing entities.
spawn(nameOrTag, opts?)Creates a runtime clone.
wait, repeat, cancelWait, cancelRepeatEntity-owned one-shot and repeating timers.
sendMessage, broadcastMessageTargeted, tag-group or scene-wide script messaging.
tween, cancelTweenProperty animation over game time.

#Detailed global API guide

The Global scripting API explains each object with examples. Use Input, Persistence, Pathfinding and Tween API for focused guides.

#Per-entity component modules

Component modules such as this.rigidbody, this.sprite, this.camera and this.text depend on the components attached to the entity. The complete script module index lists every supported member from all 24 script API modules, its access type and required context. The this reference explains EntityContext shortcuts and prerequisites.

#Fixed update

onFixedUpdate(dt) runs on the fixed physics cadence (60 steps per second in the supplied runtime). Use it for logic that should follow fixed-step physics timing; use onUpdate(dt) for frame-based presentation and input handling.

#Coordinate spaces

Entity positions, mouse.x/y, touch x/y, raycast points and navigation waypoints use world-space coordinates. Mouse/touch screenX/screenY values are raw game-canvas pixels. Camera reference resolution and world units are separate concepts.