### VolumeToggle Usage Examples Source: https://easel.games/docs/reference/audio Basic implementation of a volume toggle and an example of separating sound effects from music volume controls. ```text Toolbar { VolumeToggle } ``` ```text Toolbar { VolumeToggle(amplifier=Amplifier:Sfx) VolumeToggle(amplifier=Amplifier:Music) } ``` -------------------------------- ### Get Game Metadata Source: https://easel.games/docs/reference/game Access information about the game start time, project name, and execution mode. ```text GameStartTimestamp -> timestamp ``` ```text InPageMode -> boolean ``` ```text ProjectName -> string ``` -------------------------------- ### Basic Print Usage Source: https://easel.games/docs/reference/ui-sections Simple examples of printing text to the UI. ```ui Print { "Hello, world!" } ``` ```ui Print { %(PlayerName) } ``` ```ui Print { "Hello, " + PlayerName + "!" } ``` -------------------------------- ### Gravity Configuration Examples Source: https://easel.games/docs/reference/physics Common patterns for setting gravity values using numbers or vectors. ```text Gravity = 10 Gravity = @(0, 10) inside.Gravity = @(0, 10) outside.Gravity = @(0, 0) ``` -------------------------------- ### GameStartTimestamp Source: https://easel.games/docs/reference/game Returns the timestamp of when the game started. ```APIDOC ## GameStartTimestamp ### Description Returns a timestamp representing the date and time the current game started. ### Signature `GameStartTimestamp -> timestamp` ``` -------------------------------- ### FindKey usage examples Source: https://easel.games/docs/reference/collections Demonstrates finding keys in an array using a predicate function with value and index parameters. ```text let numbers = [11, 22, 33]; let key = numbers.Find(|n| n % 2 == 0) // key will be 1 let key = numbers.Find(|n, k| k*2 == 4) // key will be 2 ``` -------------------------------- ### CommenceGame Source: https://easel.games/docs/reference/episodes Marks the start point of the game and locks the game to prevent new human players from joining. ```APIDOC ## CommenceGame(noLock?) ### Description Marks this moment as the start point of the game. Replays will start from this point. Spectators will also be preferentially assigned to a game that has commenced. This function will also lock the game, preventing new human players from joining, unless the `noLock` parameter is truthy. ``` -------------------------------- ### Line Point Definition Example Source: https://easel.games/docs/reference/polygons Example of defining a simple two-point line. ```text [@(0, 0), @(100, 0)] ``` -------------------------------- ### Example: Conditional UI Layouts Source: https://easel.games/docs/reference/inputs Demonstrates nesting UI elements within touchscreen-specific blocks to provide device-appropriate controls. ```Easel BottomRightContent { TouchscreenOnly { VirtualJoystick(radius=5) } } ``` ```Easel TopContent { TouchscreenOnly { "Tap to start" } NonTouchscreenOnly { "Click to start" } } ``` -------------------------------- ### Commence game Source: https://easel.games/docs/reference/episodes Marks the start of a game and locks it to prevent new players, unless noLock is true. ```text CommenceGame(noLock?=) ``` -------------------------------- ### Formatted Print Usage Source: https://easel.games/docs/reference/ui-sections Example of printing formatted content using spans. ```ui Print { "Hello, " Span(bold=true, color=#00ff00) { %(PlayerName) } "!" } ``` -------------------------------- ### Get Party Interface Intent Source: https://easel.games/docs/reference/multiplayer Returns an intent to navigate to the party interface for inviting friends. ```text PartyIntent -> intent ``` -------------------------------- ### Manage Heading Source: https://easel.games/docs/reference/physics Gets, sets, or awaits changes to the body's heading in radians. ```javascript body.Heading -> angle ``` ```javascript body.Heading = angle ``` ```javascript await body.Heading -> angle ``` -------------------------------- ### Manage Body Position Source: https://easel.games/docs/reference/physics Methods for getting, setting, and awaiting changes to an entity's body position. ```javascript body.Pos -> vector ``` ```javascript body.Pos = value ``` ```javascript await body.Pos -> vector ``` -------------------------------- ### Get Remix Intent Source: https://easel.games/docs/reference/game Returns an intent to navigate the user to the game editor for remixing. ```text RemixIntent -> intent ``` -------------------------------- ### Get Player Screen Size Source: https://easel.games/docs/reference/inputs Returns the current screen size of the owner player in em units. ```text owner.ScreenSize -> vector ``` -------------------------------- ### Initialize TouchscreenVirtualPointer Source: https://easel.games/docs/reference/inputs Enables virtual mouse pointer simulation for touchscreen players, with optional priority and body tracking. ```Easel this.TouchscreenVirtualPointer(audience?=, priority?, [body?, owner?]) ``` -------------------------------- ### Unshift Source: https://easel.games/docs/reference/collections Inserts a value at the start of an Array. ```APIDOC ## Unshift ### Description Inserts a value at the start of an Array. The array is modified in-place and returned for chaining. If the collection is not an Array, it is returned unchanged. ### Signature `collection.Unshift(value) -> collection` ### Parameters - **value** (any) - Required - The value to insert at the beginning of the array. ``` -------------------------------- ### Manage Physics Space Source: https://easel.games/docs/reference/physics Provides access to get, set, or await changes to the physics space associated with a body. ```text body.PhysicsSpace -> value ``` ```text body.PhysicsSpace = value ``` ```text await body.PhysicsSpace -> entity ``` -------------------------------- ### Initialize VirtualJoystick Source: https://easel.games/docs/reference/inputs Creates a virtual joystick element with configurable dimensions, colors, and padding. ```text VirtualJoystick(radius=, knobProportion?, backgroundColor?, borderRounding?, hPadding?, knobColor?, padding?, shadow?, vPadding?, [ui]) |use ui| { } ``` ```text VirtualJoystick2(radius=, knobProportion?, backgroundColor?, borderRounding?, hPadding?, knobColor?, padding?, shadow?, vPadding?, [ui]) |use ui| { } ``` -------------------------------- ### StartsWith Source: https://easel.games/docs/reference/strings Checks if a string starts with a specified substring. ```APIDOC ## StartsWith ### Description Returns `true` if the string starts with the specified substring, otherwise false. If either or both parameters are nullish, returns `undefined`. ### Signature `x.StartsWith(needle) -> boolean` ``` -------------------------------- ### Initialize KeyboardVirtualJoystick Source: https://easel.games/docs/reference/inputs Configures keyboard keys to simulate joystick movement for an entity. ```javascript this.KeyboardVirtualJoystick(up=, down, left, right, priority?, audience?, [owner?]) ``` ```javascript this.KeyboardVirtualJoystick2(up=, down, left, right, priority?, audience?, [owner?]) ``` -------------------------------- ### Pos Source: https://easel.games/docs/reference/physics Gets, sets, or awaits the position of an entity body. ```APIDOC ## Pos ### Description Manages the position of an entity body. ### Get Position `body.Pos -> vector` Returns the current position of the body. Returns undefined if body is nullish. ### Set Position `body.Pos = value` Sets the current position of the body. Creates an immovable body if one does not exist. ### Await Position `await body.Pos -> vector` Waits for the position of the body to move, then returns the new value. ``` -------------------------------- ### Define ZUnderlay and ZOverlay components Source: https://easel.games/docs/reference/ui-elements Syntax definitions for creating layer elements. Requires a containing HStack or VStack with zStack=true. ```text ZUnderlay(align?=, animate?, backgroundColor?, font?, gap?, hPadding?, height?, opacity?, padding?, vAlign?, vPadding?, width?, [ui]) |use ui| { } ``` ```text ZOverlay(align?=, animate?, backgroundColor?, font?, gap?, hPadding?, height?, opacity?, padding?, vAlign?, vPadding?, width?, [ui]) |use ui| { } ``` -------------------------------- ### body.Heading Source: https://easel.games/docs/reference/physics Gets, sets, or awaits the heading of a body in radians. ```APIDOC ## body.Heading ### Description Gets or sets the current heading of the body in radians. Also supports awaiting a change in heading. ### Signature - `body.Heading -> angle` - `body.Heading = angle` - `await body.Heading -> angle` ``` -------------------------------- ### body.GravityScale Source: https://easel.games/docs/reference/physics Gets or sets the gravity scale multiplier for a body. ```APIDOC ## body.GravityScale ### Description Gets or sets the current gravity scale of the body. A value of 1 applies normal gravity, while 0 disables gravity for the body. ### Signature - `body.GravityScale -> vector` - `body.GravityScale = value` ``` -------------------------------- ### Initialize a PopoutMenu Source: https://easel.games/docs/reference/ui-elements Defines the structure and configuration parameters for a PopoutMenu element. ```text PopoutMenu(popoutFrom?=, align?, animate?, backgroundColor?, expand?, gap?, hPadding?, height?, minWidth?, minHeight?, padding?, shadow?, vPadding?, width?, [ui]) |use ui:header, use ui| { } ``` -------------------------------- ### BeforeCollide Source: https://easel.games/docs/reference/physics Waits until the start of a collision involving a collider belonging to the entity. ```APIDOC ## BeforeCollide ### Description Waits until the start of a collision involving a collider belonging to this entity. A collision starts once the two colliders involved come into contact. ### Parameters - **Id** (Id?) - Optional - If provided, waits for a collision involving the collider that matches that Id. ### Returns - **that** (Entity) - The entity that owns the other collider. - **point** (Vector) - The collision point, specifically the midpoint of the contact surface in world-space coordinates. ``` -------------------------------- ### RemoveRange Source: https://easel.games/docs/reference/collections Removes a specified number of elements from an Array starting at a given index. ```APIDOC ## RemoveRange ### Description Removes `count` elements starting from a particular `index` in an Array. The Array is modified in-place and returned for chaining. ### Signature `collection.RemoveRange(index, count) -> collection` ### Parameters - **index** (number) - The starting index for removal. - **count** (number) - The number of elements to remove. ``` -------------------------------- ### Image(image, backgroundColor?, cover?, expand?, height?, opacity?, reveal?, shadow?, sharp?, stretch?, tooltip?, width?, [ui]) Source: https://easel.games/docs/reference/ui-elements Creates an image element in the user interface with various styling and layout options. ```APIDOC ## Image(image, backgroundColor?, cover?, expand?, height?, opacity?, reveal?, shadow?, sharp?, stretch?, tooltip?, width?, [ui]) ### Description Creates an image element in the user interface. Supports various styling, sizing, and effect properties. ### Parameters - **image** (Asset) - Required - The image asset to display (e.g., @fireball.png). - **backgroundColor** (Color) - Optional - The color to display behind the image. - **height** (Number) - Optional - The height of the image in em units. - **width** (Number) - Optional - The width of the image in em units. - **expand** (Boolean or Number) - Optional - Expands the element to fill remaining container space. - **stretch** (Boolean) - Optional - If true, expands to fill the full cross-axis of the container. - **cover** (Boolean) - Optional - If true, zooms the image to fill the element dimensions. - **tooltip** (String) - Optional - Text to display on mouse hover. - **opacity** (Number) - Optional - Opacity from 0 to 1. - **reveal** (Boolean) - Optional - If true, hides element until mouse hover. - **shadow** (Number) - Optional - Opacity of the drop shadow from 0 to 1. - **ui** (UI) - Optional - The slot in the user interface where the image will be inserted. ``` -------------------------------- ### body.TurningInertia Source: https://easel.games/docs/reference/physics Gets the turning inertia of the body, which acts as the rotational analog of mass. ```APIDOC ## body.TurningInertia ### Description Gets the turning inertia of the body. The resulting turn rate from an impulse is inversely proportional to this value. It is automatically calculated from the shape, density, and offsets of the body's colliders. ``` -------------------------------- ### body.Speed Source: https://easel.games/docs/reference/physics Gets or sets the current speed of the body in distance per second. ```APIDOC ## body.Speed ### Description Gets or sets the current speed of the body, measured in distance per second. If the body is nullish or refers to an entity with no body, this operation does nothing. ### Usage - **Get**: `body.Speed` (returns number) - **Set**: `body.Speed = value` ``` -------------------------------- ### Create spectate intent Source: https://easel.games/docs/reference/episodes Returns an intent to navigate to the game's spectate interface. ```text SpectateIntent -> intent ``` -------------------------------- ### space.PhysicsTimescale Source: https://easel.games/docs/reference/physics Gets, sets, or awaits changes to the physics timescale for a specific space. ```APIDOC ## space.PhysicsTimescale ### Description Controls the speed of the physics simulation for a given space. Defaults to the World space. ### Parameters - **space** (Entity) - Optional - The Space for which to read or set the timescale. Defaults to World. ### Operations - **Get**: `space.PhysicsTimescale -> number` - **Set**: `space.PhysicsTimescale = value` - **Await**: `await space.PhysicsTimescale -> number` ``` -------------------------------- ### Hear(sound, seek, volume, body, audience, owner) Source: https://easel.games/docs/reference/audio Plays a sound asset, optionally with positional audio effects. ```APIDOC ## Hear(sound, seek, volume, body, audience, owner) ### Description Plays a sound asset to completion. Supports positional audio if a body is provided. ### Parameters - **sound** (Asset) - Required - The sound asset to play (e.g., '@fireball.esfx'). - **seek** (Number) - Optional - Seek position. - **volume** (Number) - Optional - Volume proportion from 0 to 1. Defaults to 1. - **body** (Entity, Vector or Null) - Optional - Position the sound originates from. Defaults to null (no positional effects). - **audience** (Entity, Symbol or Flag) - Optional - Specifies who hears the sound. Defaults to Audience:All. - **owner** (Entity) - Optional - The player or team who owns the sound. ``` -------------------------------- ### body.PhysicsSpace Source: https://easel.games/docs/reference/physics Gets, sets, or awaits changes to the physics space associated with a body. ```APIDOC ## body.PhysicsSpace ### Description Manages the physics space for a body. Setting to null moves the body into null space, disabling collisions. ### Operations - **Get**: `body.PhysicsSpace -> value` - **Set**: `body.PhysicsSpace = value` - **Await**: `await body.PhysicsSpace -> entity` ``` -------------------------------- ### Initialize TabHeadersDisplay Source: https://easel.games/docs/reference/ui-elements Displays the headers used to select tabs. Must be a descendant of a Tabs element. ```text TabHeadersDisplay(unselectedOpacity?=, [ui]) ``` -------------------------------- ### Create PremiumBadge UI Element Source: https://easel.games/docs/reference/users Initializes a badge representing a specific Easel+ level for display in the user interface. ```text PremiumBadge(level=, [ui]) ``` -------------------------------- ### space.Gravity Source: https://easel.games/docs/reference/physics Methods to get, set, or await changes to the gravity vector of a space. ```APIDOC ## space.Gravity ### Description Get or set the gravity vector for a given space. If no gravity is assigned, it defaults to @(0, 0). ### Get Gravity - **space** (Entity) - Optional - The space to query. Defaults to World. - **Returns** (vector) - The current gravity vector. ### Set Gravity - **space** (Entity) - Optional - The space to modify. Defaults to World. - **value** (Vector|Number|null|undefined) - Required - The new gravity value. If a number is provided, it sets gravity to @(0, value). ### Await Gravity - **await space.Gravity** - Returns the new gravity vector once it changes. ``` -------------------------------- ### Eliminated Source: https://easel.games/docs/reference/players Gets or sets the elimination status of a player, or waits for a change in status. ```APIDOC ## owner.Eliminated ### Description Returns whether the `owner` player has been eliminated. Can also be used to set the elimination status or await a change in status. ### Methods - **Get**: `owner.Eliminated -> boolean` - **Set**: `owner.Eliminated = boolean` - **Await**: `await owner.Eliminated -> boolean` ``` -------------------------------- ### Create an OpenDrawerIntent Source: https://easel.games/docs/reference/ui-elements Initializes an intent to open drawers within a DrawerBoundary. ```text OpenDrawerIntent -> intent ``` -------------------------------- ### Get Current Tick Number Source: https://easel.games/docs/reference/game Returns the current tick count of the game. ```text Tick -> number ``` -------------------------------- ### ManagePremiumIntent Source: https://easel.games/docs/reference/users Returns an Intent to go to the Easel+ management page for subscription management. Navigating to this page will force the player to leave the current game or page. ```APIDOC ## ManagePremiumIntent ### Description Returns an Intent to go to the Easel+ management page. This allows people to subscribe, unsubscribe, and modify their Easel+ subscription. The intent can be attached to a button to trigger it. Navigating to the Easel+ management page will force the player to leave the current game or page. ``` -------------------------------- ### Get TicksPerSecond Source: https://easel.games/docs/reference/game Returns the constant number of ticks per second, which is 60. ```text TicksPerSecond -> number ``` -------------------------------- ### PopoutMenu(popoutFrom, align, animate, backgroundColor, expand, gap, hPadding, height, minWidth, minHeight, padding, shadow, vPadding, width, [ui]) Source: https://easel.games/docs/reference/ui-elements Creates a popout menu UI element where content is hidden until the header is clicked. The menu supports custom styling and layout properties. ```APIDOC ## PopoutMenu ### Description Creates a popout menu user interface element. This keeps the main content of the menu invisible until the header of the menu is clicked. The contents of the menu will be laid out vertically, and all children will be expanded to fill the full width of the menu. ### Parameters - **popoutFrom** (Symbol) - Optional - Determines which corner of the menu that should be anchored to the button. Valid values: PopoutFrom:TopLeft, PopoutFrom:TopRight, PopoutFrom:BottomLeft, PopoutFrom:BottomRight. Defaults to PopoutFrom:TopLeft. - **backgroundColor** (Color) - Optional - The background color of the menu. - **shadow** (Number) - Optional - The opacity of the menu's drop shadow (0 to 1). - **align** (Symbol) - Optional - The alignment of the contents ($left, $center, $right). Defaults to $left. - **animation** (Symbol) - Optional - The animation to use when the menu is opened. - **width** (Number) - Optional - The width of the menu in em units. - **height** (Number) - Optional - The height of the menu in em units. - **minWidth** (Number) - Optional - The minimum width of the menu in em units. - **minHeight** (Number) - Optional - The minimum height of the menu in em units. - **expand** (Boolean) - Optional - Whether the menu should expand to fill the full height of the screen. - **padding** (Number) - Optional - The padding around the contents in em units. - **hPadding** (Number) - Optional - The horizontal padding in em units. - **vPadding** (Number) - Optional - The vertical padding in em units. - **gap** (Number) - Optional - The gap between each element in em units. - **ui** (UI) - Optional - The slot in the user interface where the element will be inserted. ### Slots - **ui:header** (UI) - Content displayed on the button that opens the menu. - **ui** (UI) - Content displayed in the body of the menu. ``` -------------------------------- ### body.TurnRate Source: https://easel.games/docs/reference/physics Gets or sets the current turn rate of the body in revolutions per second. ```APIDOC ## body.TurnRate ### Description Gets or sets the current turn rate of the body, measured in revolutions per second. If the body is nullish or refers to an entity with no body, this operation does nothing. ### Usage - **Get**: `body.TurnRate` (returns number) - **Set**: `body.TurnRate = value` ``` -------------------------------- ### LoginToggle Source: https://easel.games/docs/reference/users Creates a UI element to handle login or account management navigation. ```APIDOC ## LoginToggle ### Signature `LoginToggle([ui=]) |use ui:whenLoggedIn, use ui:whenLoggedOut| { }` ### Description Creates an element in the user interface that allows the player to login, or if they are already logged in will display a button to take them to their Manage Account page. ### Parameters - **ui** (UI) - Optional - The slot in the user interface where the element will be inserted. - **ui:whenLoggedIn** (UI) - Optional - Content to display when logged in. - **ui:whenLoggedOut** (UI) - Optional - Content to display when logged out. ### Example ``` ToolbarRight { LoginToggle } ``` ``` -------------------------------- ### ShowIntent Function Source: https://easel.games/docs/reference/ui-sections Returns an intent to display previously created and dismissed content. Attach this intent to a button to trigger the visibility change. ```text ShowIntent(key?) -> intent ``` -------------------------------- ### Get and Set Gravity Source: https://easel.games/docs/reference/physics Methods to retrieve or modify the gravity vector for a specific space. ```text space.Gravity -> vector ``` ```text space.Gravity = value ``` -------------------------------- ### Initialize TabDisplay Source: https://easel.games/docs/reference/ui-elements Displays the body content of the currently selected tab. Must be a descendant of a Tabs element. ```text TabDisplay([ui=]) ``` -------------------------------- ### Video Source: https://easel.games/docs/reference/ui-elements Creates a background video element in the user interface. ```APIDOC ## Video ### Description Creates a background video element in the user interface. This will autoplay a video inline in the background on a loop. The video will always be muted. ### Parameters - **video** (Asset) - Required - The video to display (e.g., @fireball.mp4). - **image** (Asset) - Optional - The image to display while the video is loading. - **noControls** (Boolean) - Optional - If true, hides video controls. - **width** (Number) - Optional - Width in em units. - **height** (Number) - Optional - Height in em units. - **expand** (Boolean/Number) - Optional - Expands element to fill remaining space. - **stretch** (Boolean) - Optional - Expands to fill full cross-axis. - **cover** (Boolean) - Optional - Zooms video to fill element. - **shadow** (Number) - Optional - Opacity of drop shadow (0 to 1). - **tooltip** (String) - Optional - Text to display on hover. - **backgroundColor** (Color) - Optional - Color behind the video. - **ui** (UI) - Optional - The slot in the UI where the video is inserted. ``` -------------------------------- ### Manage Entity Categories Source: https://easel.games/docs/reference/physics Methods to get, set, or delete the categories assigned to an entity. ```javascript this.Category -> categories ``` ```javascript this.Category = categories ``` ```javascript delete this.Category -> categories ``` -------------------------------- ### owner.Team (Get) Source: https://easel.games/docs/reference/teams Retrieves the team entity associated with the given owner player entity. ```APIDOC ## GET owner.Team ### Description Gets the team entity of the given owner player entity. If the player is not assigned to a team, it returns the owner entity itself. If the owner is not a player, it looks up the owner and returns its team. Returns undefined if the owner is nullish. ``` -------------------------------- ### Manage Entity Ownership Source: https://easel.games/docs/reference/teams Methods for getting, setting, waiting for, and removing the owner of an entity. ```javascript this.Owner -> player ``` ```javascript this.Owner = player ``` ```javascript await this.Owner -> player ``` ```javascript delete this.Owner ``` -------------------------------- ### Product Collection Method Source: https://easel.games/docs/reference/collections Calculates the product of elements in a collection, optionally using a selector to determine the factor for each element. ```text collection.Product(selector?) -> number ``` ```javascript let numbers = [1, 2, 3]; let product = numbers.Product // Will be 6 let squareProduct = numbers.Product(|n| n*n) // Will be 36 ``` -------------------------------- ### KeyboardVirtualJoystick Source: https://easel.games/docs/reference/inputs Initializes a virtual joystick behavior on an entity using specified keyboard keys. ```APIDOC ## KeyboardVirtualJoystick(up, down, left, right, priority?, audience?, owner?) ### Description Makes the game simulate a virtual joystick for players that are using the keyboard. ### Parameters - **up** (Keycode or Array of Keycodes) - Required - Keys to use for moving the joystick up. - **down** (Keycode or Array of Keycodes) - Required - Keys to use for moving the joystick down. - **left** (Keycode or Array of Keycodes) - Required - Keys to use for moving the joystick left. - **right** (Keycode or Array of Keycodes) - Required - Keys to use for moving the joystick right. - **priority** (Number) - Optional - Integer between -128 and 127. Defaults to 0. - **audience** (Entity, Symbol or Flag) - Optional - Defines who the behavior applies to. Defaults to owner. - **owner** (Entity) - Optional - The player or team who owns this behavior. ``` -------------------------------- ### ProjectName Source: https://easel.games/docs/reference/game Returns the project name. ```APIDOC ## ProjectName ### Description Returns the name of the project, according to its `easel.toml` file. ### Signature `ProjectName -> string` ``` -------------------------------- ### SpawnEachPlayer Source: https://easel.games/docs/reference/players Defines the main behavior for all players in the game, including those who join later. ```APIDOC ## SpawnEachPlayer ### Description Defines the main behavior for players in the game. A new behavior is started for each player currently in the game and for every new player that joins in the future. Calling this a second time replaces the previous call. ## delete SpawnEachPlayer ### Description Removes a previously-declared SpawnEachPlayer and stops any behaviors started by it. ``` -------------------------------- ### Calculate Vector Sums in Collections Source: https://easel.games/docs/reference/collections Demonstrates basic summation of vectors and summation using a selector function to transform elements. ```Easel let array = [@(1,2), @(3,4), @(5,6)]; let vectorSum = array.VectorSum // Will be @(9,12) let doubleVectorSum = array.VectorSum(|v| 2 * v) // Will be @(18,24) ``` -------------------------------- ### Implement Live Scoreboard Source: https://easel.games/docs/reference/users Adds a ranked scoreboard to the UI based on a specific property or accumulator. Players must have the property set to a value to appear on the board. ```Easel Scoreboard(propOrAccumulator, [ui=]) ``` ```Easel pub prop owner.Score = 0 pub fn World.Main() { SpawnEachPlayer owner { owner.Score = 0 // must set the property once to appear on the scoreboard } } pub fn World.Example1() { StatusContent { Scoreboard(&Score) } } ``` -------------------------------- ### Create a Bookmark Source: https://easel.games/docs/reference/ui-elements Defines an invisible bookmark at the current UI position, which can be targeted by a ScrollToBookmarkIntent. ```text Bookmark(key?, [ui=]) ``` -------------------------------- ### Manage GravityScale Source: https://easel.games/docs/reference/physics Gets or sets the gravity multiplier for a body. A value of 0 disables gravity for the body. ```javascript body.GravityScale -> vector ``` ```javascript body.GravityScale = value ``` -------------------------------- ### RoamingToggle(ui=) Source: https://easel.games/docs/reference/multiplayer Creates a UI element to toggle roaming mode, allowing players to switch between home-region play and cross-region play. ```APIDOC ## RoamingToggle(ui=) ### Description Creates an element in the user interface that allows the player to switch roaming mode on or off. When a player is roaming, they are able to play with players from all regions. ### Parameters - **ui** (UI) - Optional - The slot in the user interface where the element will be inserted. ### Subblock Slots - **ui:whenOn** (UI) - Optional - Content displayed when roaming is enabled. If empty, displays a default button. - **ui:whenOff** (UI) - Optional - Content displayed when roaming is disabled. If empty, displays a default button. ``` -------------------------------- ### Await Screen Size Change Source: https://easel.games/docs/reference/inputs Suspends execution until the owner player's screen size changes, returning the updated dimensions in em units. ```text await owner.ScreenSize -> vector ``` -------------------------------- ### Get Team Entity Source: https://easel.games/docs/reference/teams Retrieves the team entity associated with the owner. Returns the owner itself if no team is assigned. ```text owner.Team -> team ``` -------------------------------- ### Emit text with % Source: https://easel.games/docs/reference/ui-elements Outputs text directly into the UI context. This is a compiler intrinsic rather than a standard function. ```text %(value) ``` -------------------------------- ### Create PlayerNameEditor UI Source: https://easel.games/docs/reference/players Initializes a text input field for players to update their display name. ```text PlayerNameEditor(width?=, [ui]) ``` -------------------------------- ### Create HStack and VStack layout containers Source: https://easel.games/docs/reference/ui-elements Defines horizontal or vertical stacking containers for organizing child UI elements. ```Easel HStack(align?=, animate?, backgroundColor?, borderRounding?, expand?, font?, gap?, hOverflow?, hOverlap?, hPadding?, height?, minHeight?, maxHeight?, minWidth?, maxWidth?, opacity?, overflow?, padding?, vAlign?, vOverflow?, vOverlap?, vPadding?, width?, wrap?, zStack?, [ui]) |use ui| { } ``` ```Easel VStack(align?=, animate?, backgroundColor?, borderRounding?, expand?, font?, gap?, hOverflow?, hOverlap?, hPadding?, height?, minHeight?, maxHeight?, minWidth?, maxWidth?, opacity?, overflow?, padding?, vAlign?, vOverflow?, vOverlap?, vPadding?, width?, wrap?, zStack?, [ui]) |use ui| { } ``` -------------------------------- ### Control Physics Timescale Source: https://easel.games/docs/reference/physics Allows getting, setting, or awaiting changes to the physics simulation speed for a specific space. ```text space.PhysicsTimescale -> number ``` ```text space.PhysicsTimescale = value ``` ```text await space.PhysicsTimescale -> number ``` -------------------------------- ### Initialize HoldIntent Source: https://easel.games/docs/reference/ui-elements Creates an intent for handling button press and release signals with optional payload and opacity. ```text HoldIntent(payload?, opacity?=) -> intent ``` -------------------------------- ### Get or Simulate Vertical Scroll Source: https://easel.games/docs/reference/inputs Waits for vertical scroll input or simulates a scroll event by a specified delta. ```text await owner.ScrollWheelY -> number ``` ```text owner.ScrollWheelY(delta) ``` -------------------------------- ### AfterGameCommenced Source: https://easel.games/docs/reference/episodes Waits until the game has commenced. If the game has already commenced, returns immediately. ```APIDOC ## await AfterGameCommenced ### Description Waits until the game has commenced. If the game has already commenced, returns immediately. ``` -------------------------------- ### KeyboardVirtualJoystick2 Source: https://easel.games/docs/reference/inputs Initializes an alternative virtual joystick behavior on an entity using specified keyboard keys. ```APIDOC ## KeyboardVirtualJoystick2(up, down, left, right, priority?, audience?, owner?) ### Description An alternative implementation that makes the game simulate a virtual joystick for players that are using the keyboard. ### Parameters - **up** (Keycode or Array of Keycodes) - Required - Keys to use for moving the joystick up. - **down** (Keycode or Array of Keycodes) - Required - Keys to use for moving the joystick down. - **left** (Keycode or Array of Keycodes) - Required - Keys to use for moving the joystick left. - **right** (Keycode or Array of Keycodes) - Required - Keys to use for moving the joystick right. - **priority** (Number) - Optional - Integer between -128 and 127. Defaults to 0. - **audience** (Entity, Symbol or Flag) - Optional - Defines who the behavior applies to. Defaults to owner. - **owner** (Entity) - Optional - The player or team who owns this behavior. ``` -------------------------------- ### Get or Simulate Horizontal Scroll Source: https://easel.games/docs/reference/inputs Waits for horizontal scroll input or simulates a scroll event by a specified delta. ```text await owner.ScrollWheelX -> number ``` ```text owner.ScrollWheelX(delta) ``` -------------------------------- ### Get or wait for replay ID Source: https://easel.games/docs/reference/episodes Retrieves the current game's unique replay ID or waits for it to change. ```text CurrentReplayId -> string ``` ```text await CurrentReplayId -> string ``` -------------------------------- ### ZOverlay(align, animate, backgroundColor, font, gap, hPadding, height, opacity, padding, vAlign, vPadding, width, ui) Source: https://easel.games/docs/reference/ui-elements Lays out children above other elements in a containing stack. ```APIDOC ## ZOverlay ### Description Lays out its children above the other elements in the containing HStack or VStack that has `zStack=true`. ### Parameters - **align** (Symbol) - Optional - Alignment of contents (Align:Left, Align:Center, Align:Right). - **animate** (Symbol) - Optional - Animation to use for the layer. - **backgroundColor** (Color) - Optional - Background color of the layer. - **font** (Font) - Optional - Font to use. - **gap** (Number) - Optional - Gap between elements in em units. - **hPadding** (Number) - Optional - Padding on left and right sides in em units. - **height** (Number) - Optional - Height of the layer in em units. - **opacity** (Number) - Optional - Opacity from 0 to 1. - **padding** (Number) - Optional - Inner padding in em units. - **vAlign** (Symbol) - Optional - Vertical alignment (VAlign:Top, VAlign:Middle, VAlign:Bottom). - **vPadding** (Number) - Optional - Padding on top and bottom sides in em units. - **width** (Number) - Optional - Width of the layer in em units. - **ui** (UI) - Required - The slot in the user interface where the layer will be inserted. ``` -------------------------------- ### Initialize RoamingToggle UI Element Source: https://easel.games/docs/reference/multiplayer Defines a UI element for roaming mode toggling with optional slots for custom content. ```Easel RoamingToggle([ui=]) |use ui:whenOn, use ui:whenOff| { } ``` -------------------------------- ### Wait for Player Join Source: https://easel.games/docs/reference/players Suspends execution until a new player joins the game. ```text await PlayerJoined -> owner ``` -------------------------------- ### body.Mass Source: https://easel.games/docs/reference/physics Gets the mass of the physics body. Returns the density multiplied by the area of attached colliders, or undefined if the body is immovable. ```APIDOC ## body.Mass ### Description Gets the mass of the body. If the body is immovable, returns undefined. If the body is nullish or has no colliders, returns 0. ### Signature `body.Mass -> number` ``` -------------------------------- ### Get Sign of Number Source: https://easel.games/docs/reference/math Returns 1 for positive, -1 for negative, and 0 for zero. Returns undefined if the input is nullish. ```text x.Sign -> number ``` ```text Sign(x) -> number ``` -------------------------------- ### Spawn an entity Source: https://easel.games/docs/reference/entities Spawns a new entity with a defined behavior block that runs concurrently. ```Easel Spawn |use this| { } -> entity ``` ```Easel await Spawn |use this| { } ``` -------------------------------- ### Icon(icon, width?, [ui]) Source: https://easel.games/docs/reference/ui-elements Creates an icon element in the user interface using Font Awesome icons. ```APIDOC ## Icon(icon, width?, [ui]) ### Description Creates an icon element in the user interface. Only free Font Awesome icons are supported. ### Parameters - **icon** (String) - Required - The name of the Font Awesome icon to display (e.g., "fa-solid fa-crown"). - **width** (Number) - Optional - The width of the icon in em units. - **ui** (UI) - Optional - The slot in the user interface where the icon will be inserted. ``` -------------------------------- ### Get Eliminated Tick Source: https://easel.games/docs/reference/players Retrieves the tick count when a player was eliminated. Returns null if not eliminated or undefined for invalid inputs. ```text owner.EliminatedTick -> tick ``` -------------------------------- ### RemoveRange collection method Source: https://easel.games/docs/reference/collections Removes a specified number of elements starting from a given index. Modifies the array in-place and returns it for chaining. ```javascript let a = [1, 2, 3, 4, 5] a.RemoveRange(1, 2) // `a` is now [1, 4, 5] ``` -------------------------------- ### Create replay intent Source: https://easel.games/docs/reference/episodes Returns an intent to watch a replay for a specific episode ID. ```text ReplayIntent(episodeId, showOnlyIfExists?=) -> intent ``` -------------------------------- ### Get Player Pointer Position Source: https://easel.games/docs/reference/inputs Retrieves the last known pointer position for the owner player. Returns undefined if the owner is nullish. ```text owner.Pointer -> vector ``` -------------------------------- ### Get Joystick Position Source: https://easel.games/docs/reference/inputs Retrieves the current joystick position as a vector. Joystick refers to the left stick, while Joystick2 refers to the right. ```text owner.Joystick -> vector ``` ```text owner.Joystick2 -> vector ``` -------------------------------- ### Spawn a new bot player Source: https://easel.games/docs/reference/players Creates a bot player with an optional name and an optional behavior subblock. ```Easel SpawnBot(name?) |use this = use owner| { } -> player ``` -------------------------------- ### PrintTop(duration, blend, audience, owner) Source: https://easel.games/docs/reference/ui-sections Overlays content at the top of the interface. ```APIDOC ## PrintTop(duration?, blend?, audience?, [owner?]) ### Description Overlays content at the top of the interface. ### Parameters - **duration** (Number) - Optional - The number of ticks for which to display this content. Defaults to 60s. - **blend** (Symbol) - Optional - How to blend the content of this transmission with the content behind it. - **audience** (Entity, Symbol or Flag) - Optional - If provided, only the specified audience will see the content. Defaults to owner. - **owner** (Entity) - Optional - The player or team who owns the content. ``` -------------------------------- ### Get length with Length Source: https://easel.games/docs/reference/values Calculates the length or size of a V2, Array, Map, Range, or String. Returns undefined for unsupported types. ```text x.Length -> value ``` ```text Length(x) -> value ``` -------------------------------- ### Create FlyInWords element Source: https://easel.games/docs/reference/ui-elements Initializes a text element that animates individual words onto the screen. ```Easel FlyInWords(text, [ui=]) ``` -------------------------------- ### Get body turning inertia Source: https://easel.games/docs/reference/physics Retrieves the rotational inertia, which determines resistance to turning impulses. Returns undefined for bodies with noRotation enabled. ```javascript body.TurningInertia -> number ``` -------------------------------- ### UI Content Display Methods Source: https://easel.games/docs/reference/ui-sections Methods to display content in specific UI sections. Each method accepts parameters to control layout, audience, and behavior. ```APIDOC ## UI Content Display Methods ### Description Displays content in designated UI sections. The content is tied to the lifespan of the provided entity (`this`). ### Methods - `this.Content(...)` - `this.ContentScreen(...)` - `this.SidebarContent(...)` - `this.OverlayContent(...)` - `this.TopContent(...)` - `this.BottomContent(...)` - `this.BottomLeftContent(...)` - `this.BottomRightContent(...)` ### Parameters - **this** (Entity) - Required - Defines the lifespan of the content. - **Id** (auto) - Optional - Identifier for replacing existing content. - **key** (Keyable) - Optional - Identifier for ShowIntent. - **blend** (Symbol) - Optional - Blend mode for the section. - **dismissed** (Boolean) - Optional - If true, hidden until shown via ShowIntent. - **maxWidth** (Number/Null) - Optional - Max width in em units. - **order** (Number) - Optional - Ordering priority. - **audience** (Entity/Symbol/Flag) - Optional - Audience visibility. - **owner** (Entity) - Optional - Owner for audience interpretation. - **expand** (Boolean) - Optional - (ContentScreen only) Whether to fill the screen vertically. ``` -------------------------------- ### Get and Set Body Velocity Source: https://easel.games/docs/reference/physics Access or update the velocity vector of a body. Operations are ignored if the body is nullish or lacks a physical body component. ```text body.Velocity -> vector ``` ```text body.Velocity = value ``` -------------------------------- ### Get Body Mass Source: https://easel.games/docs/reference/physics Retrieves the mass of a body based on density and collider area. Returns undefined for immovable bodies and 0 for nullish or invalid bodies. ```text body.Mass -> number ``` -------------------------------- ### Define behavior for all players Source: https://easel.games/docs/reference/players Sets the main behavior for all current and future players. Subsequent calls replace previous ones. ```Easel SpawnEachPlayer |use this = use owner| { } ``` ```Easel delete SpawnEachPlayer ``` -------------------------------- ### Get or set body speed Source: https://easel.games/docs/reference/physics Accesses or modifies the body's speed in distance per second. Fails silently if the body is nullish or lacks a physics body. ```javascript body.Speed -> number ``` ```javascript body.Speed = value ``` -------------------------------- ### OnlinePlayerScoreboard Implementation Source: https://easel.games/docs/reference/users Displays a live scoreboard of all online players ranked by the specified accumulator. ```Easel pub accumulator owner.NumLifetimeWins = 0 pub fn World.Example1() { StatusContent { OnlinePlayerScoreboard(&NumLifetimeWins) } } ``` -------------------------------- ### Get or set body turn rate Source: https://easel.games/docs/reference/physics Accesses or modifies the body's rotational speed in revolutions per second. Fails silently if the body is nullish or lacks a physics body. ```javascript body.TurnRate -> number ``` ```javascript body.TurnRate = value ``` -------------------------------- ### Login Intent Usage Source: https://easel.games/docs/reference/users Creates an intent to trigger the login process, typically attached to a button. ```text LoginIntent -> intent ``` ```text Toolbar { Button(LoginIntent) { "Login" } } ``` -------------------------------- ### Initialize HoverIntent Source: https://easel.games/docs/reference/ui-elements Creates an intent for handling hover and unhover signals with an optional payload. ```text HoverIntent(payload?) -> intent ``` -------------------------------- ### SpectateIntent Source: https://easel.games/docs/reference/episodes Returns an Intent to go to the spectate interface for the game. ```APIDOC ## SpectateIntent ### Description Returns an Intent to go to the spectate interface for your game. The spectate interface allows people to watch live games. ``` -------------------------------- ### Spawn Source: https://easel.games/docs/reference/entities Spawns a new entity with a defined behavior block. The behavior executes concurrently, and the function returns when the subblock reaches an await. ```APIDOC ## Spawn ### Description Spawns a new entity. The subblock defines the main behavior for the entity, which executes concurrently with the rest of the game. When the entity despawns, its main behavior is terminated. ### Signature `Spawn |use this| { } -> entity` ### Usage `await Spawn |use this| { }` Spawns a new entity and waits for it to despawn before continuing. ``` -------------------------------- ### await owner.Team (Observe) Source: https://easel.games/docs/reference/teams Waits for a change in the player's team assignment. ```APIDOC ## AWAIT owner.Team ### Description Waits until the team of the given owner player entity changes, then returns the new value. If the owner is nullish or not a player entity, this function will wait forever. ``` -------------------------------- ### Blank(width, height, expand, [ui]) Source: https://easel.games/docs/reference/ui-elements Creates a blank space of the specified size in the user interface, useful for layout spacing. ```APIDOC ## Blank(width, height, expand, [ui]) ### Description Creates a blank space of the specified size in the user interface. This is useful for creating spacing between elements. ### Parameters - **width** (Number) - Optional - The width of the blank space, in em units. - **height** (Number) - Optional - The height of the blank space, in em units. - **expand** (Boolean or Number) - Optional - If set, expands the element to fill the remaining space of its container. A value of true is equivalent to 1. - **ui** (UI) - Optional - The slot in the user interface where the blank space will be inserted. ``` -------------------------------- ### collection.First Source: https://easel.games/docs/reference/collections Returns the first element and its key from the collection. ```APIDOC ## collection.First ### Description Returns the first element in the collection. The collection can be an Array, Map, or Range. If the collection is nullish, returns undefined. ### Signature `collection.First -> value, key` ``` -------------------------------- ### %(value) Source: https://easel.games/docs/reference/ui-elements Emits the provided value as text into the user interface. ```APIDOC ## %(value) ### Description Emits the value as text into the user interface. Must be called from within a UI section or element. ``` -------------------------------- ### SpawnBot(name?) Source: https://easel.games/docs/reference/players Creates a new bot player and returns a player entity. Bots have IsHuman set to false and do not persist data between games. ```APIDOC ## SpawnBot(name?) ### Description Creates a new bot player and returns a new player entity. The bot's IsHuman property is always false, and it does not store persistent data. ### Parameters - **name** (string) - Optional - Defines the PlayerName of the new bot. Defaults to 'Bot' if not specified. ``` -------------------------------- ### Create a Dropdown UI element Source: https://easel.games/docs/reference/ui-elements Adds a dropdown selector to the UI. Use the same Id with await Selected to retrieve the player's choice. ```Easel Dropdown(key?=, [ui]) |use ui| { } ``` -------------------------------- ### PremiumBadge(level, [ui]) Source: https://easel.games/docs/reference/users Creates a UI element representing a specific Easel+ level, useful for indicating requirements for features. ```APIDOC ## PremiumBadge(level, [ui]) ### Description Creates a element that represents a particular level of Easel+. This can be used to communicate to players a minimum level that is required to unlock a feature. ### Parameters - **level** (Number) - Required - The level of Easel+ that the badge represents. - **ui** (UI) - Optional - The slot in the user interface where the element will be inserted. ``` -------------------------------- ### RemixIntent Source: https://easel.games/docs/reference/game Returns an intent to take the user to the game editor. ```APIDOC ## RemixIntent ### Description Returns an Intent to take the user to the game editor where they can create their own version of this game. ### Signature `RemixIntent -> intent` ``` -------------------------------- ### Create ChatEnabledDropdown Source: https://easel.games/docs/reference/multiplayer Creates a dropdown menu for players to toggle chat visibility settings. ```text ChatEnabledDropdown(width?=, [ui]) ``` -------------------------------- ### PrintOverlay(duration, blend, audience, owner) Source: https://easel.games/docs/reference/ui-sections Displays content centered over the entire interface. ```APIDOC ## PrintOverlay(duration?, blend?, audience?, [owner?]) ### Description Displays content centered over the entire interface. ### Parameters - **duration** (Number) - Optional - The number of ticks for which to display this content. Defaults to 60s. - **blend** (Symbol) - Optional - How to blend the content of this transmission with the content behind it. - **audience** (Entity, Symbol or Flag) - Optional - If provided, only the specified audience will see the content. Defaults to owner. - **owner** (Entity) - Optional - The player or team who owns the content. ``` -------------------------------- ### ConsoleLog usage Source: https://easel.games/docs/reference/debugging Displays a message in the browser console. ```text ConsoleLog(x) ```