Skip to main content

Graphics

Constants

Position:AtPointer -> symbol

Returns a special symbol that can be used to attach a sprite to the Pointer. Use this by passing it to the body parameter of PolygonSprite, ImageSprite or TextSprite.

Resolution

Resolution:Max -> symbol
Resolution:High -> symbol
Resolution:Low -> symbol

Used to modify the player's resolution using the ResolutionIntent function.

  • Maximum resolution is the highest quality, but may run slower on older devices. If a retina display is detected, the game will be rendered to subpixel resolution.
  • High resolution is a good balance between quality and performance. It only renders to normal pixel resolution and not to subpixels.
  • Low resolution is the fastest option. It renders to half pixel resolution, creating a pixel-art look which can help your game run smoothly on older devices.

BlendHue

alpha.BlendHue(from, to) -> color

Returns a color that is a blend between from and to. The blending is done in the Hue-Saturation-Lightness color space.

alpha controls the amount of blending and should be a value between 0 and 1, where 0 is from and 1 is to. Defaults to 0 if not provided.

If only one of the inputs is nullish, the other input is returned.

Camera

this.Camera([body], radius?=, freeRadius?, aspectRatio?, maxScreenSizePx?, 
transitionSpeed?, priority?, [audience?, owner?])
delete this.Camera

Determines the target position of the camera for a given audience.

  • this (Entity): Determines the lifespan of the camera. When this despawns, the camera will be deleted.

  • body (Entity or Vector): Determines the position. If body is an Entity, the camera will track the position of the entity's Body. If body is a Vector, the camera will be fixed at that position. Defaults to this.

  • radius (Number): Controls the zoom level of the camera. The camera will zoom in or out to ensure this radius is visible. Defaults to 50.

  • freeRadius (Number): When the camera is within this distance of the body it will stop moving, allowing body to freely move around within this radius without affecting the camera. Defaults to 0.

  • aspectRatio (Number or Null): The aspect ratio of the camera, expressed as width divided by height. If null (the default), the aspect ratio will be determined by the window size.

  • maxScreenSizePx (Number): If specified, the camera will only be used when the screen width or height is less than or equal to this value, in pixels.

  • transitionSpeed (Number): The speed at which the camera moves, where 1 is instant and 0 is never. A value of 0.25 means the camera will move 25% of the way to its target position each frame. Defaults to 1.

  • audience (Entity): If set to a player or team, only determines the position of the camera for that player or team. Otherwise, determines the camera for all players and spectators. Defaults to the value of owner.

  • owner (Entity): Only used as the default value for audience.

  • priority (Number): Only the Camera with the highest priority will be used. Must be an integer between -128 and 127. Defaults to 0.

Darken

color.Darken(darken) -> color

Returns a new color that is darker than the input color by the given fraction. If the fraction is negative, the color will be lightened instead. If darken is nullish, returns the original color unchanged. If color is nullish, returns undefined.

Fade

color.Fade(fade) -> color

Returns a new color with its opacity blended with transparent by the given fraction. If the fraction is negative, the color will be made more opaque instead. fade must be number between 0 and 1, where 1 represents fully transparent. If fade is nullish, returns the original color unchanged. If color is nullish, returns undefined.

FullscreenIntent

FullscreenIntent(fullscreen) -> intent

Returns an intent to enter or exit fullscreen mode. Attach the intent to a button Button to trigger it.

  • fullscreen (Boolean): true to enter fullscreen mode, false to exit.

ImageSprite

this.ImageSprite<Id = auto>(image, [body], bodyOffset?=, screenOffset?, color?, overlay?, 
repeatX?, repeatY?, [radius, angleOffset?, audience?, flicker?,
layer?, luminous?, noRotation?, opacity?, owner?, ownerColor?,
shading?, shadow?, shine?, strobe?])
delete this.ImageSprite<Id>

Creates a sprite which will display an image attached to a given body.

  • this (Entity): Defines the lifespan of the sprite. When this despawns, the sprite is deleted.

  • Id: A unique identifier for the sprite. If a sprite already exists on this with the same Id, the previous sprite will be deleted.

  • image (Asset): The image to display. Must be an asset, e.g. @fireball.png

  • radius (Number): The radius of sprite, in game-world coordinates.

  • repeatX (Number): The number of times to repeat the image along the x-axis. Defaults to 1.

  • repeatY (Number): The number of times to repeat the image along the y-axis. Defaults to 1.

  • body (Entity, Vector or Symbol): The position of the sprite, whether it is attached to an Entity's body or fixed at a Vector position. If given the special symbolic value of Position:AtPointer, the sprite will attach itself to the player's pointer.

  • bodyOffset (Vector): If set, offsets the position of the sprite by this Vector. bodyOffset will be rotated to match the body's current heading.

  • screenOffset (Vector): If set, offsets the position of the sprite by this Vector.

  • angleOffset (Number): If set, the sprite image will be rotated by this angle, expressed in radians. This is in addition to the rotation of the body.

  • noRotation (Boolean): If true, the sprite will not rotate with the body. Defaults to false.

  • strobe (Number or Boolean): A proportion between 0 and 1 which controls how much this sprite should Strobe with its this entity. true will also be interpreted as 1, and false will be interpreted as 0. Defaults to 1.

  • layer (Number): The rendering layer of the sprite. Sprites on higher layers will be drawn over the top of sprites on lower layers. Must be a number between -128 and 127 (inclusive). Defaults to 0.

  • overlay (Number): When multiple sprites are attached to the same body, sprites with higher overlay will be drawn over the top of sprites with a lower overlay. Must be a number between -128 and 127 (inclusive). Defaults to 0.

  • audience (Entity): If set to a player or team, only that player or team can see the sprite.

  • color (Color): If set, the image is tinted with this color.

  • opacity (Number): A proportion between 0 and 1 where 1 means opaque and 0 means transparent.

  • flicker (Number): A proportion between 0 and 1 which controls how much of a random color should be blended into the color. The random color changes on every frame, creating a flickering effect.

  • owner (Entity): The player entity that owns the sprite.

  • ownerColor (Boolean or Number or Flags): If set to a Number, indicates the amount the sprite should be tinted with the owner's color. The number should be between 0 and 1. If set to a Boolean, true is equivalent to 1 and false is equivalent to 0. If set to a Flag, will be interpreted as an alliance flag, which filters which players will see the sprite in the owner's color. For example Alliance:Friendly will mean only the owner and their allies will see the sprite in their owner color.

  • luminous (Number): A proportion between 0 and 1 controlling how much the sprite adds rather than mixes its color with what is behind it. Setting luminous to 1 will make a sprite look like it is made of light.

  • shine (Number): A proportion between 0 and 1 controlling how much white to add to the sprite, making it look brighter. This can be controlled dynamically to make a sprite flash or glow temporarily.

  • shading (Number): A proportion between 0 and 1 controlling the intensity of shading. Shading adds a gradient to the graphic, mixing it with more black as it gets closer to its bottom left corner. This can make flat shapes look more interesting.

  • shadow (Number): A proportion between 0 and 1 controlling the opacity of the drop shadow, where 1 makes a fully opaque shadow.

Lighten

color.Lighten(lighten) -> color

Returns a new color that is lighter than the input color by the given fraction. If the fraction is negative, the color will be darkened instead. If lighten is nullish, returns the original color unchanged. if color is nullish, returns undefined.

PointerAimingLine

this.PointerAimingLine([body], priority?=, lengthMultiplier?, maxLength?, diminish?, 
fade?, taper?, [radius, owner?, audience?, flicker?, shadow?,
bloom?, bloomAlpha?, color?, crater?, feather?, glare?, glareAlpha?,
layer?, luminous?, opacity?, shine?])
delete this.PointerAimingLine

Creates a behavior which will display a line between a body and the current position of the mouse pointer. It is better to use this function than manually creating a Streak for example, because this will display the aiming line with zero lag.

  • this (Entity): Defines the lifespan of the line. When this despawns, the line is deleted.

  • body (Entity or Vector): Defines the position the line will be drawn from, whether that be from a fixed position Vector, or tracking an Entity's body.

  • audience (Entity) and owner (Entity): If set to a player or team, only that player or team can see their aiming line. If not provided, defaults to owner.

  • priority (Number): Only the highest priority aiming line will be shown. Must be an integer between -128 and 127. Defaults to 0.

  • radius (Number): The width of the line, measured as the distance from the center to the edge.

  • lengthMultiplier (Number): The length of the line will be equal to the distance between body and the player's Pointer, multiplied by this number. Defaults to 3.

  • maxLength (Number): The maximum length of the line, in game-world coordinates. Defaults to 100.

  • layer (Number): The rendering layer of the sprite. Sprites on higher layers will be drawn over the top of sprites on lower layers. Must be a number between -128 and 127 (inclusive). Defaults to 0.

  • diminish (Number): A proportion between 0 and 1 where 1 means its shine, bloomAlpha and glareAlpha will diminish to zero as the line extends away from body, while 0 means they will remain the same. This can be used to make the line look brighter at one end. Defaults to 1.

  • fade (Number or Color): If set to a Number, a proportion between 0 and 1 where 1 means it will fade to transparent as it extends away from the body, while 0 means it will remain fully opaque. If set to a Color, the line will fade to that color as it extends away from body. Defaults to 1.

  • taper (Number): A proportion between 0 and 1 where 1 means it will taper to a point as it extends away from the body, while 0 means it will remain the same width. Defaults to 0.

  • color (Color): The color of the line.

  • opacity (Number): A proportion between 0 and 1 where 1 means opaque and 0 means transparent.

  • flicker (Number): A proportion between 0 and 1 which controls how much of a random color should be blended into the color. The random color changes on every frame, creating a flickering effect.

  • luminous (Number): A proportion between 0 and 1 controlling how much the sprite adds rather than mixes its color with what is behind it, where 1 will add fully and will make the line look like it is made of light.

  • shine (Number): A proportion between 0 and 1 controlling how much white to add to the line, making it look brighter.

  • crater (Number): A proportion between 0 and 1 which determines the size of a transparent hole in the middle of the graphic.

  • feather (Number): A proportion between 0 and 1 which determines the softness of the border of the line, where 0 means the border will be hard and 1 means the border will be soft.

  • glare (Number): A proportion between 0 and 1 which determines the size of the glare. Glare makes the inside of the shape brighter, as if it is emitting light. A glare of 1 means the glare reaches the edge of the shape.

  • glareAlpha (Number): A proportion between 0 and 1 controlling the intensity of the glare. A glareAlpha of 1 means the glare becomes fully white.

  • bloom (Number): Makes the space outside of the line glow. This number is the maximum distance from the line that the bloom should extend.

  • bloomAlpha (Number): A proportion between 0 and 1 controlling the opacity of the bloom.

  • shadow (Number): A proportion between 0 and 1 controlling the opacity of the drop shadow, where 1 makes a fully opaque shadow.

PolygonSprite

this.PolygonSprite<Id = auto>([shape, body], angleOffset?=, bodyOffset?, screenOffset?, overlay?, 
image?, imageAnchor?, tile?, [audience?, bloom?, bloomAlpha?,
color?, crater?, feather?, flicker?, glare?, glareAlpha?,
layer?, luminous?, noRotation?, opacity?, owner?, ownerColor?,
shading?, shadow?, shine?, strobe?, tolerance?])
delete this.PolygonSprite<Id>

Creates a sprite which will display a polygon attached to a given body.

  • this (Entity): Defines the lifespan of the sprite. When this despawns, the sprite is deleted.

  • Id: A unique identifier for the sprite. If a sprite already exists on this with the same Id, the previous sprite will be deleted.

  • shape (Polygon): The shape of the sprite.

  • tolerance (Number): Some shapes may need to be approximated in order to be rendered. This value determines the maximum allowed distance between the original shape and the approximated shape. Greater tolerance allows of better performance but less accuracy. Defaults to 0.025.

  • body (Entity, Vector or Symbol): The position of the sprite, whether it be attached to an Entity's body or fixed at a Vector position. If given the special symbolic value of Position:AtPointer, the sprite will attach itself to the player's pointer.

  • angleOffset (Number): If set, the sprite will be rotated by this angle.

  • bodyOffset (Vector): If set, determines the attachment point of the sprite on the body.

  • screenOffset (Vector): If set, offsets the position of the sprite by this Vector. Unlike bodyOffset, this is done in screen space and so does not follow the rotation of the body.

  • noRotation (Boolean): If true, the sprite will not rotate with the body. Defaults to false.

  • image (Asset): If set, the sprite will be textured with this image.

  • imageAnchor (Vector): Designates which part of the image will be placed at the sprite's position. Defaults to @(0, 0), which places the center of the image at the sprite's position. A value of @(-1, -1) would place the top left corner of the image at the sprite's position, while a value of @(1, 1) would place the bottom right corner of the image at the sprite's position.

  • tile (Number): If set, the image will be repeated across the sprite with this radius.

  • strobe (Number or Boolean): A proportion between 0 and 1 which controls how much this sprite should Strobe with its this entity. true will also be interpreted as 1, and false will be interpreted as 0. Defaults to 1.

  • layer (Number): The rendering layer of the sprite. Sprites on higher layers will be drawn over the top of sprites on lower layers. Must be a number between -128 and 127 (inclusive). Defaults to 0.

  • overlay (Number): When multiple sprites are attached to the same body, sprites with higher overlay will be drawn over the top of sprites with a lower overlay. Must be a number between -128 and 127 (inclusive). Defaults to 0.

  • audience (Entity): If set to a player or team, only that player or team can see the sprite.

  • color (Color): If set, the sprite is tinted with this color.

  • opacity (Number): A proportion between 0 and 1 where 1 means opaque and 0 means transparent.

  • flicker (Number): A proportion between 0 and 1 which controls how much of a random color should be blended into the color. The random color changes on every frame, creating a flickering effect.

  • owner (Entity): The player entity that owns the sprite.

  • ownerColor (Boolean or Number or Flags): If set to a Number, indicates the amount the sprite should be tinted with the owner's color. The number should be between 0 and 1. If set to a Boolean, true is equivalent to 1 and false is equivalent to 0. If set to a Flag, will be interpreted as an alliance flag, which filters which players will see the sprite in the owner's color. For example Alliance:Friendly will mean only the owner and their allies will see the sprite in their owner color.

  • luminous (Number): A proportion between 0 and 1 controlling how much the sprite adds rather than mixes its color with what is behind it. Setting luminous to 1 will make a sprite look like it is made of light.

  • shine (Number): A proportion between 0 and 1 controlling how much white to add to the sprite, making it look brighter. This can be controlled dynamically to make a sprite flash or glow temporarily.

  • crater (Number): A proportion between 0 and 1 which determines the size of a transparent hole in the middle of the graphic. This is useful for creating circular indicators, for example.

  • feather (Number): A proportion between 0 and 1 which determines the softness of the border of the shape, where 0 means the border will be hard and 1 means the border will be soft.

  • glare (Number): A proportion between 0 and 1 which determines the size of the glare. Glare makes the inside of the shape brighter, as if it is emitting light. A glare of 1 means the glare reaches the edge of the shape.

  • glareAlpha (Number): A proportion between 0 and 1 controlling the intensity of the glare. A glareAlpha of 1 means the glare becomes fully white.

  • bloom (Number): Makes the space outside of the polygon glow. This number is the maximum distance from the polygon that the bloom should extend.

  • bloomAlpha (Number): A proportion between 0 and 1 controlling the opacity of the bloom.

  • shading (Number): A proportion between 0 and 1 controlling the intensity of shading. Shading adds a gradient to the graphic, mixing it with more black as it gets closer to its bottom left corner. This can make flat shapes look more interesting.

  • shadow (Number): A proportion between 0 and 1 controlling the opacity of the drop shadow, where 1 makes a fully opaque shadow.

ResolutionDropdown

ResolutionDropdown(width?=, [ui])

Creates a resolution editor dropdown in the user interface that allows the current player to change the resolution of the game. Higher resolutions look better but may run slower on older devices.

  • width (Number): the width of the resolution editor in em units.
  • ui (UI): the slot in the user interface to insert the resolution editor element.

ResolutionIntent

ResolutionIntent(resolution) -> intent

Returns an intent to change the resolution to a particular level. Attach the intent to a button Button to trigger it.

  • resolution (Symbol): The new resolution level. Valid values are Resolution:Max, Resolution:High and Resolution:Low. This function will return undefined if given any other value. See Resolution for more information.

ResolutionToggle

ResolutionToggle([ui=]) |use ui:whenMax, use ui:whenHigh, use ui:whenLow| { }

Creates a element in the user interface that allows the player to toggle their graphics resolution.

  • ui (UI): The slot in the user interface where the element will be inserted.

Subblock: The subblock will be called immediately to populate the element's content. It is optional to provide this as there are defaults for all three resolution levels. Use the %ui:whenMax { ... } syntax to populate one of the slots, see UI for more information.

  • ui:whenMax (UI): populate this slot with the content that should be displayed when resolution is set to maximum. If left empty, will display a default button that will change the resolution to high.
  • ui:whenHigh (UI): populate this slot with the content that should be displayed when resolution is set to high. If left empty, will display a default button that will change the resolution to low.
  • ui:whenLow (UI): populate this slot with the content that should be displayed when resolution is set to low. If left empty, will display a default button that will change the resolution to maximum.

SolidBackground

this.SolidBackground(color, priority?=, audience?, [owner?])

Creates a behavior that sets the background of the screen to a solid color.

  • this (Entity): Defines the lifespan of the background. When this despawns, this behavior is deleted.
  • color (Color): The color of the background.
  • priority (Number): Only the highest priority background will be shown. Must be an integer between -128 and 127. Defaults to 0.
  • audience (Entity): If set to a player or team, only that player or team can see this particular background. Defaults to the value of owner. If nullish, the background is visible to everyone.
  • owner (Entity): Only used as a default value for audience.
delete this.SolidBackground

Deletes a previously-assigned solid background behavior from this Entity.

Spark

this.Spark<Id = auto>([body], bodyOffset?=, screenOffset?, velocity?, speed?, [color, 
radius, audience?, bloom?, bloomAlpha?, crater?, diminish?,
dissipate?, fade?, feather?, flicker?, glare?, glareAlpha?,
glaze?, layer?, luminous?, opacity?, owner?, ownerColor?,
shadow?, shine?, splatter?, strobe?, taper?])

Creates a spark particle. A spark is a particle in the shape of a circle that dissipates over time. It can be used to create a variety of effects, for example the trail behind a comet or the smoke of an icy whirlwind.

  • this (Entity): Defines the entity the Spark will Strobe with. Unlike other functions, the lifetime of a spark is not tied to its this entity. If this despawns, the spark will continue to exist until it dissipates like normal.

  • Id: The ID for the spark. Sparks with the same this and Id will be rendered together by the engine. This is done to improve performance. Certain fields, such as layer, are shared between all sparks in the same group. The first spark determines the value of these fields for the entire group.

  • body (Entity or Vector): The position of the spark, whether it be spawned at an Entity's body or at a specific Vector position.

  • strobe (Number or Boolean): A proportion between 0 and 1 which controls how much this sprite should Strobe with its this entity. true will also be interpreted as 1, and false will be interpreted as 0. Defaults to 1.

  • dissipate (Number): The number of ticks before the spark dissipates. Defaults to 15.

  • audience (Entity): If set to a player or team, only that player or team can see this particular spark. By default, all players can see the spark.

  • bodyOffset (Vector): An offset from the body position where the spark should be spawned. This offset will be rotated to match the body's heading.

  • screenOffset (Vector): An offset from the body position where the spark should be spawned.

  • glaze (Number or Bool): If true, randomly offsets the position of the graphic to a random position within the Perimeter of the entity. If a Number, should be a proportion between 0 and 1 where 1 spawns the spark at a random point on the edge of the perimeter, while 0 spawns it in the center.

  • velocity (Vector): The velocity of the spark.

  • speed (Number): The speed of the spark. If speed is set, the spark will move in a random direction at that speed.

  • splatter (Number): A proportion between 0 and 1 which controls how much the spark should splatter. Splattering will primarily occur in the direction of velocity of the body Entity. This can be used to create the splatter from a fireball, for example, when it hits.

  • layer (Number): The layer at which to draw the spark. Must be an integer between -128 and 127 (inclusive). Graphics on a higher layer will be drawn over the top of graphics on a lower layer. Defaults to 0.

  • radius (Number): The radius of the spark.

  • crater (Number): A proportion between 0 and 1 which determines the size of a transparent hole in the middle of the graphic. This is useful for creating circular indicators, for example.

  • feather (Number): A proportion between 0 and 1 which determines the softness of the border of the shape, where 0 means the border will be hard and 1 means the border will be soft.

  • color (Color): The color of the spark.

  • opacity (Number): A proportion between 0 and 1 where 1 means opaque and 0 means transparent.

  • fade (Color or Number): If a Color, determines the color the spark will blend towards as it dissipates. If a Number, should be a proportion between 0 and 1 where 1 means the spark will fade to transparent as it dissipates, while 0 means it will not fade at all.

  • flicker (Number): A proportion between 0 and 1 which controls how much of a random color should be blended into the color. The random color changes on every frame, creating a flickering effect.

  • luminous (Number): A proportion between 0 and 1 controlling how much the sprite adds rather than mixes its color with what is behind it. Setting luminous to 1 will make a spark look like it is made of light.

  • shine (Number): A proportion between 0 and 1 controlling how much white to add to the sprite, making it look brighter. This can be controlled dynamically to make a sprite flash or glow temporarily.

  • owner (Entity): The player entity that owns the spark.

  • ownerColor (Boolean or Number or Flags): If set to a Number, indicates the amount the spark should be tinted with the owner's color. The number should be between 0 and 1. If set to a Boolean, true is equivalent to 1 and false is equivalent to 0. If set to a Flag, will be interpreted as an alliance flag, which filters which players will see the spark in the owner's color. For example Alliance:Friendly will mean only the owner and their allies will see the spark in their owner color.

  • glare (Number): A proportion between 0 and 1 which determines the size of the glare. Glare makes the inside of the shape brighter, as if it is emitting light. A glare of 1 means the glare reaches the edge of the shape.

  • glareAlpha (Number): A proportion between 0 and 1 controlling the intensity of the glare. A glareAlpha of 1 means the glare becomes fully white.

  • bloom (Number): Makes the space outside of the polygon glow. This number is the maximum distance from the polygon that the bloom should extend.

  • bloomAlpha (Number): A proportion between 0 and 1 controlling the opacity of the bloom.

  • shadow (Number): A proportion between 0 and 1 controlling the opacity of the drop shadow, where 1 makes a fully opaque shadow.

  • diminish (Number): A proportion between 0 and 1 where 1 means its shine, bloomAlpha and glareAlpha will diminish to zero as it dissipates, while 0 means they will remain the same. This can be used to make the line look brighter at one end. Defaults to 1.

  • taper (Number): A proportion between 0 and 1 where 1 means the radius, bloom and glare will reduce to zero as it dissipates, while 0 means it will remain the same radius. Defaults to 1.

Strand

this.Strand<Id = auto>([body], to, [color=, radius, audience?, bloom?, bloomAlpha?, 
crater?, dissipate?, fade?, feather?, flicker?, glare?, glareAlpha?,
layer?, luminous?, opacity?, owner?, ownerColor?, retract?,
shadow?, shine?, strobe?, taper?])
delete this.Strand<Id>

Displays a line that connects two bodies together.

  • this (Entity): Defines the lifespan of the strand. When this despawns, this behavior is deleted.

  • body (Entity or Vector): The origin position of the strand, whether it be attached to an Entity's body or at a fixed Vector position.

  • to (Entity or Vector): The end position of the strand, whether it be attached to an Entity's body or at a fixed Vector position.

  • dissipate (Number): When the this entity despawns, instead of dissipating immediately, the origin of the strand will retract. This is number of ticks it takes for the strand to retract. If the strand is deleted (using delete Strand), it will disappear immediately.

  • retract (Boolean): If false (the default), the strand will retract to its to position as it dissipates. If true, the strand will retract to its body position as it dissipates.

  • audience (Entity): If set to a player or team, only that player or team can see this particular strand. By default, all players can see the strand.

  • radius (Number): The radius of the strand.

  • crater (Number): A proportion between 0 and 1 which determines the size of a transparent hole in the middle of the graphic. This is useful for creating circular indicators, for example.

  • feather (Number): A proportion between 0 and 1 which determines the softness of the border of the shape, where 0 means the border will be hard and 1 means the border will be soft.

  • layer (Number): The layer at which to draw the strand. Must be an integer between -128 and 127 (inclusive). Graphics on a higher layer will be drawn over the top of graphics on a lower layer. Defaults to 0.

  • color (Color): The color of the strand.

  • opacity (Number): A proportion between 0 and 1 where 1 means opaque and 0 means transparent.

  • flicker (Number): A proportion between 0 and 1 which controls how much of a random color should be blended into the color. The random color changes on every frame, creating a flickering effect.

  • fade (Color or Number): If a Color, determines the color the strand will blend towards as it dissipates. If a Number, should be a proportion between 0 and 1 where 1 means the strand will fade to transparent as it dissipates, while 0 means it will not fade at all.

  • owner (Entity): The player entity that owns the strand.

  • ownerColor (Boolean or Number or Flags): If set to a Number, indicates the amount the strand should be tinted with the owner's color. The number should be between 0 and 1. If set to a Boolean, true is equivalent to 1 and false is equivalent to 0. If set to a Flag, will be interpreted as an alliance flag, which filters which players will see the strand in the owner's color. For example Alliance:Friendly will mean only the owner and their allies will see the strand in their owner color.

  • shine (Number): A proportion between 0 and 1 controlling how much white to add to the sprite, making it look brighter.

  • luminous (Number): A proportion between 0 and 1 controlling how much the sprite adds rather than mixes its color with what is behind it. Setting luminous to 1 will make a strand look like it is made of light.

  • strobe (Number or Boolean): A proportion between 0 and 1 which controls how much this sprite should Strobe with its this entity. true will also be interpreted as 1, and false will be interpreted as 0.

  • bloom (Number): Makes the space outside of the polygon glow. This number is the maximum distance from the polygon that the bloom should extend.

  • bloomAlpha (Number): A proportion between 0 and 1 controlling the opacity of the bloom.

  • glare (Number): A proportion between 0 and 1 which determines the size of the glare. Glare makes the inside of the shape brighter, as if it is emitting light. A glare of 1 means the glare reaches the edge of the shape.

  • glareAlpha (Number): A proportion between 0 and 1 controlling the intensity of the glare. A glareAlpha of 1 means the glare becomes fully white.

  • shadow (Number): A proportion between 0 and 1 controlling the opacity of the drop shadow, where 1 makes a fully opaque shadow.

  • taper (Number): A proportion between 0 and 1 where 1 means the radius, bloom and glare will reduce to zero as it dissipates, while 0 means it will remain the same radius.

Streak

this.Streak<Id = auto>([body], bodyOffset?=, screenOffset?, [color, radius, audience?, 
bloom?, bloomAlpha?, crater?, diminish?, dissipate?, fade?,
feather?, flicker?, glare?, glareAlpha?, layer?, luminous?,
opacity?, owner?, ownerColor?, shadow?, shine?, strobe?, taper?])
delete this.Streak<Id>

Displays a streak, which is a rendered line that dissipates over time.

  • this (Entity): Defines the entity that owns the streak. Unlike other functions, if this despawns, streak will continue to exist until it dissipates like normal.

  • Id: The ID for the streak. This is used to distinguish between different streaks on the same entity.

  • body (Entity or Vector or Array): The origin position of the streak, whether it be attached to an Entity's body or at a fixed Vector position. If an Entity, the head of the streak will be extended to the current position of the body. This only occurs once - to make the Streak follow the body, you must call this function again. If a Vector, the head of the streak will be extended to the position of the vector. If an Array, the all the points of the streak streak will be replaced with the points in the array.

  • bodyOffset (Vector): An offset to apply to all new streak points. If body is an Entity with a body, this offset will be rotated to match the current heading of body.

  • screenOffset (Vector): An offset to apply to all new streak points.

  • dissipate (Number): The number of ticks it takes for the streak to dissipate. Defaults to 15.

  • audience (Entity): If set to a player or team, only that player or team can see this particular streak. By default, all players can see the streak.

  • radius (Number): The radius of the streak.

  • crater (Number): A proportion between 0 and 1 which determines the size of a transparent hole in the middle of the graphic.

  • feather (Number): A proportion between 0 and 1 which determines the softness of the border of the shape, where 0 means the border will be hard and 1 means the border will be soft.

  • layer (Number): The layer at which to draw the streak. Must be an integer between -128 and 127 (inclusive). Graphics on a higher layer will be drawn over the top of graphics on a lower layer. Defaults to 0.

  • color (Color): The color of the streak.

  • opacity (Number): A proportion between 0 and 1 where 1 means opaque and 0 means transparent.

  • flicker (Number): A proportion between 0 and 1 which controls how much of a random color should be blended into the color. The random color changes on every frame, creating a flickering effect.

  • owner (Entity): The player entity that owns the streak.

  • ownerColor (Boolean or Number or Flags): If set to a Number, indicates the amount the streak should be tinted with the owner's color. The number should be between 0 and 1. If set to a Boolean, true is equivalent to 1 and false is equivalent to 0. If set to a Flag, will be interpreted as an alliance flag, which filters which players will see the streak in the owner's color. For example Alliance:Friendly will mean only the owner and their allies will see the streak in their owner color.

  • shine (Number): A proportion between 0 and 1 controlling how much white to add to the streak, making it look brighter.

  • luminous (Number): A proportion between 0 and 1 controlling how much the streak adds rather than mixes its color with what is behind it. Setting luminous to 1 will make a streak look like it is made of light.

  • strobe (Number or Boolean): A proportion between 0 and 1 which controls how much this streak should Strobe with its this entity. true will also be interpreted as 1, and false will be interpreted as 0.

  • bloom (Number): Makes the space outside of the polygon glow. This number is the maximum distance from the polygon that the bloom should extend.

  • bloomAlpha (Number): A proportion between 0 and 1 controlling the opacity of the bloom.

  • glare (Number): A proportion between 0 and 1 which determines the size of the glare. Glare makes the inside of the shape brighter, as if it is emitting light. A glare of 1 means the glare reaches the edge of the shape.

  • glareAlpha (Number): A proportion between 0 and 1 controlling the intensity of the glare. A glareAlpha of 1 means the glare becomes fully white.

  • shadow (Number): A proportion between 0 and 1 controlling the opacity of the drop shadow, where 1 makes a fully opaque shadow.

  • fade (Color or Number): If a Color, determines the color the streak will blend towards as it dissipates. If a Number, should be a proportion between 0 and 1 where 1 means the streak will fade to transparent as it dissipates, while 0 means it will not fade at all.

  • diminish (Color or Number): If a Color, determines the color the streak will blend towards as it dissipates. If a Number, should be a proportion between 0 and 1 where 1 means the streak will diminish to transparent as it dissipates, while 0 means it will not diminish at all.

  • taper (Number): A proportion between 0 and 1 where 1 means the radius, bloom and glare will reduce to zero as it dissipates, while 0 means it will remain the same radius.

Strobe

this.Strobe<Id = auto>([dissipate?], growth?=, shine?)

Makes all graphics attached to this strobe once. This can be used to simulate hit flashes, power-ups, or other visual effects.

  • this (Entity): The entity to strobe.
  • Id: An optional ID to distinguish between multiple strobes on the same entity. If a strobe already exists with the same this and Id, it will be replaced.
  • dissipate (Number): The duration of the strobe in ticks. Defaults to 15.
  • growth (Number): A proportion of the growth to apply to all graphics. Defaults to 0. A growth of 0.5 would make the graphics grow to 1.5 times their normal size temporarily.
  • shine (Number): A proportion of shine to apply to all graphics. Should be a value between 0 and 1. This is in addition to any shine already applied to the graphics. Defaults to 0.

Swoop

this.Swoop<Id = auto>([body], bodyOffset?=, screenOffset?, angleOffset?, [color, 
length, audience?, bloom?, bloomAlpha?, crater?, diminish?,
dissipate?, fade?, feather?, flicker?, glare?, glareAlpha?,
layer?, luminous?, noRotation?, opacity?, owner?, ownerColor?,
shadow?, shine?, strobe?, taper?])
delete this.Swoop<Id>

Displays a swoop, which is a sector of a circle that dissipates over time.

  • this (Entity): Defines the entity that owns the swoop. Unlike other functions, if this despawns, swoop will continue to exist until it dissipates like normal.

  • Id (String): The ID for the swoop. This is used to distinguish between different swoops on the same entity.

  • body (Entity or Vector): The position of the swoop, whether it be attached to an Entity's body or at a fixed Vector position.

  • bodyOffset (Vector): Applies an offset to body position. This will be rotated to match the current heading of body, unless noRotation is true.

  • screenOffset (Vector): Applies an offset to the body position.

  • angleOffset (Number or Array): If a Number, a new sector will be added to the swoop its previous angle to the body's heading plus angleOffset. If an Array, the swoop angles will be replaced by the angles in the array. Defaults to 0.

  • noRotation (Boolean): If set to true, the body's heading will be ignored by this function.

  • dissipate (Number): The number of ticks it takes for the swoop to dissipate. Defaults to 15.

  • audience (Entity): If set to a player or team, only that player or team can see this particular swoop. By default, all players can see the swoop.

  • length (Number): The length of the swoop, measured as the distance from the center of the body to the edge of the swoop.

  • layer (Number): The layer at which to draw the swoop. Must be an integer between -128 and 127 (inclusive). Graphics on a higher layer will be drawn over the top of graphics on a lower layer. Defaults to 0.

  • crater (Number): A proportion between 0 and 1 which determines the size of a transparent hole starting from the origin of the sector and extending to the edge of the swoop.

  • feather (Number): A proportion between 0 and 1 which determines the softness of the border of the shape, where 0 means the border will be hard and 1 means the border will be soft.

  • color (Color): The color of the swoop.

  • opacity (Number): A proportion between 0 and 1 where 1 means opaque and 0 means transparent.

  • flicker (Number): A proportion between 0 and 1 which controls how much of a random color should be blended into the color. The random color changes on every frame, creating a flickering effect.

  • owner (Entity): The player entity that owns the swoop.

  • ownerColor (Boolean or Number or Flags): If set to a Number, indicates the amount the swoop should be tinted with the owner's color. The number should be between 0 and 1. If set to a Boolean, true is equivalent to 1 and false is equivalent to 0. If set to a Flag, will be interpreted as an alliance flag, which filters which players will see the swoop in the owner's color. For example Alliance:Friendly will mean only the owner and their allies will see the swoop in their owner color.

  • strobe (Number or Boolean): A proportion between 0 and 1 which controls how much this swoop should Strobe with its this entity. true will also be interpreted as 1, and false will be interpreted as 0.

  • shine (Number): A proportion between 0 and 1 controlling how much white to add to the swoop, making it look brighter.

  • luminous (Number): A proportion between 0 and 1 controlling how much the swoop adds rather than mixes its color with what is behind it. Setting luminous to 1 will make a swoop look like it is made of light.

  • bloom (Number): Makes the space outside of the polygon glow. This number is the maximum distance from the polygon that the bloom should extend.

  • bloomAlpha (Number): A proportion between 0 and 1 controlling the opacity of the bloom.

  • glare (Number): A proportion between 0 and 1 which determines the size of the glare. Glare makes the inside of the shape brighter, as if it is emitting light. A glare of 1 means the glare reaches the edge of the shape.

  • glareAlpha (Number): A proportion between 0 and 1 controlling the intensity of the glare. A glareAlpha of 1 means the glare becomes fully white.

  • fade (Color or Number): If a Color, determines the color the swoop will blend towards as it dissipates. If a Number, should be a proportion between 0 and 1 where 1 means the swoop will fade to transparent as it dissipates, while 0 means it will not fade at all.

  • diminish (Color or Number): If a Color, determines the color the swoop will blend towards as it dissipates. If a Number, should be a proportion between 0 and 1 where 1 means the swoop will diminish to transparent as it dissipates, while 0 means it will not diminish at all.

  • taper (Number): A proportion between 0 and 1 where 1 means the radius, bloom and glare will reduce to zero as it dissipates, while 0 means it will remain the same radius. Defaults to 0 (no tapering).

TextSprite

this.TextSprite<Id = auto>(text, [body], angleOffset?=, bodyOffset?, screenOffset?, overlay?, 
widthPx?, heightPx?, anchorTop?, anchorBottom?, [audience?,
color?, crater?, feather?, flicker?, glare?, glareAlpha?,
layer?, luminous?, noRotation?, opacity?, owner?, ownerColor?,
radius?, shading?, shadow?, shine?, strobe?])
delete this.TextSprite<Id>

Creates a sprite which will display a text label attached to a given body.

  • this (Entity): Defines the lifespan of the sprite. When this despawns, the sprite is deleted.

  • Id: A unique identifier for the sprite. If a sprite already exists on this with the same Id, the previous sprite will be deleted.

  • text (String): The text to display.

  • widthPx (Number), heightPx (Number) and radius (Number): Defines the size of the label. Either heightPx or radius must be set. widthPx and heightPx specify the size of the label in pixels. Width is optional and will automatically be calculated to fit the text if not specified. Pixels are the preferred unit for text since they can guarantee the text remains readable on all screens. Otherwise, radius defines the height of the label in game-world dimensions, measured from the center to the top of the text. These can be used to ensure the text fits the scale of other sprites in the game world.

  • bodyOffset (Vector): If set, offsets the position of the sprite by this Vector. bodyOffset will be rotated to match the body's current heading.

  • screenOffset (Vector): If set, offsets the position of the sprite by this Vector.

  • angleOffset (Number): If set, the sprite will be rotated by this angle, expressed in radians. This is in addition to the rotation of the body.

  • anchorTop (Boolean): If set to true, the top of the label will be the anchor point, and the text will be placed below that.

  • anchorBottom (Boolean): If set to true, the bottom of the label will be the anchor point, and the text will be placed above that.

  • body (Entity, Vector or Symbol): The position of the sprite, whether it is attached to an Entity's body or fixed at a Vector position. If given the special symbolic value of Position:AtPointer, the sprite will attach itself to the player's pointer.

  • noRotation (Boolean): If true, the sprite will not rotate with the body. Defaults to false.

  • strobe (Number or Boolean): A proportion between 0 and 1 which controls how much this sprite should Strobe with its this entity. true will also be interpreted as 1, and false will be interpreted as 0. Defaults to 1.

  • layer (Number): The layer of the sprite. Must be an integer between -128 and 127 (inclusive). Graphics on a higher layer will be drawn over the top of graphics on a lower layer. Defaults to 0.

  • overlay (Number): When multiple sprites are attached to the same body, sprites with higher overlay will be drawn over the top of sprites with a lower overlay. Must be a number between -128 and 127 (inclusive). Defaults to 0.

  • audience (Entity): If set to a player or team, only that player or team can see the sprite.

  • color (Color): The color of the text. Defaults to white.

  • opacity (Number): A proportion between 0 and 1 where 1 means opaque and 0 means transparent.

  • flicker (Number): A proportion between 0 and 1 which controls how much of a random color should be blended into the color. The random color changes on every frame, creating a flickering effect.

  • owner (Entity): The player entity that owns the sprite.

  • ownerColor (Boolean or Number or Flags): If set to a Number, indicates the amount the sprite should be tinted with the owner's color. The number should be between 0 and 1. If set to a Boolean, true is equivalent to 1 and false is equivalent to 0. If set to a Flag, will be interpreted as an alliance flag, which filters which players will see the sprite in the owner's color. For example Alliance:Friendly will mean only the owner and their allies will see the sprite in their owner color.

  • luminous (Number): A proportion between 0 and 1 controlling how much the sprite adds rather than mixes its color with what is behind it. Setting luminous to 1 will make a sprite look like it is made of light.

  • shine (Number): A proportion between 0 and 1 controlling how much white to add to the sprite, making it look brighter.

Unfade

color.Unfade(unfade) -> color

Returns a new color with its opacity blended with fully opaque by the given fraction. If the fraction is negative, the color will be made more transparent instead. unfade must be Number between 0 and 1, where 1 represents fully opaque. If unfade is nullish, returns the original color unchanged. If color is nullish, returns undefined.

Vignette

this.Vignette(color?=, opacity?, power?, priority?, audience?, [owner?])

Creates a behavior that applies a vignette effect to the screen. This will color the edges of the screen with your specified color.

  • this (Entity): Defines the lifespan of the behavior. When this despawns, this behavior is deleted.

  • color (Color): The color of the vignette. Defaults to #000000.

  • opacity (Number): The opacity of the vignette. Defaults to 1.

  • power (Number): Controls how quickly the vignette fades away with distance from the edge. Larger numbers make the vignette fade away more quickly. Defaults to 4.

  • priority (Number): Only the highest priority vignette will be shown. Must be an integer between -128 and 127. Defaults to 0.

  • audience (Entity): If set to a player or team, only that player or team can see this particular vignette. Defaults to the value of owner. If nullish, the vignette is visible to everyone.

  • owner (Entity): Only used as a default value for audience.

delete this.Vignette

Deletes a previously-assigned vignette behavior.

WithOpacity

color.WithOpacity(opacity) -> color

Returns the same Color except with its opacity set to the given value. opacity must be a number between 0 and 1, where 0 represents fully transparent and 1 represents fully opaque.

If color is nullish, returns undefined. If opacity is nullish, returns the original color unchanged.