Graphics
Position
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.
Position:AtCamera -> symbol
Position:CameraTopLeft -> symbol
Position:CameraTop -> symbol
Position:CameraTopRight -> symbol
Position:CameraLeft -> symbol
Position:CameraRight -> symbol
Position:CameraBottomLeft -> symbol
Position:CameraBottom -> symbol
Position:CameraBottomRight -> symbol
Returns a special symbol that can be used to attach a sprite to the center, edge or corner of the camera's view.
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.
A
color.A -> number
Returns the alpha component of a color as a value between 0 and 1.
Returns undefined if the input is nullish.
B
color.B -> number
Returns the blue component of a color as a value between 0 and 1.
Returns undefined if the input is nullish.
BlendHue
alpha.BlendHue(from, to) -> color
Returns a color that is a blend between from and to.
The blending is done in the HSL 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<Id?>([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. Whenthisdespawns, the camera will be deleted. -
Id: An optional discriminator to allow for multipleCameras on the same entity. -
body(Entity or Vector): Determines the position. Ifbodyis an Entity, the camera will track the position of the entity's Body. Ifbodyis a Vector, the camera will be fixed at that position. Defaults tothis. -
radius(Number or Vector): Controls the zoom level of the camera. The camera will zoom in or out to ensure this radius is visible. Provide a Number to set both the horizontal and vertical radius to the same value. Provide a Vector to separately define a different horizontal and vertical radius. Defaults to50. -
freeRadius(Number): When the camera is within this distance of thebodyit will stop moving, allowingbodyto freely move around within this radius without affecting the camera. Defaults to0. -
aspectRatio(Number or Null): The aspect ratio of the camera, expressed as width divided by height. Ifnull(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, where1is instant and0is never. A value of0.25means the camera will move 25% of the way to its target position each frame. Defaults to1. -
audience(Entity, Symbol or Flag): If provided, sets the camera position only for the specified audience. Defaults to the value ofowner. See Audience. -
owner(Entity): The player or team who owns the camera. Only used to interpret theaudienceparameter. -
priority(Number): Only theCamerawith the highest priority will be used. Must be an integer between-128and127. Defaults to0.
CameraBoundary
this.CameraBoundary<Id?>(left?=, right?, top?, bottom?, priority?, [audience?, owner?])
delete this.CameraBoundary
Limits the viewable area of the camera for a given audience. The camera's position will be clamped to only show areas within the specified boundaries.
-
this(Entity): Determines the lifespan of the camera. Whenthisdespawns, the camera will be deleted. -
Id: An optional discriminator to allow for multipleCameraBoundarys on the same entity. -
left(Vector): If supplied, the leftmost boundary of the camera. -
right(Vector): If supplied, the rightmost boundary of the camera. -
top(Vector): If supplied, the topmost boundary of the camera. -
bottom(Vector): If supplied, the bottommost boundary of the camera. -
audience(Entity, Symbol or Flag): If provided, sets the camera boundaries only for the specified audience. Defaults to the value ofowner. See Audience. -
owner(Entity): The player or team who owns the camera. Only used to interpret theaudienceparameter. -
priority(Number): Only theCameraBoundarywith the highest priority will be used. Must be an integer between-128and127. Defaults to0.
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):
trueto enter fullscreen mode,falseto exit.
G
color.G -> number
Returns the green component of a color as a value between 0 and 1.
Returns undefined if the input is nullish.
HSL
HSL(hue, saturation, lightness, alpha?) -> color
Returns a color comprised of the given hue, saturation, lightness and alpha components in the HSL color space.
hueis a number in between0degand360deg, where0degrepresents red. Like all angles in Easel, it is represented in radians, but you can use suffixes such asdegorrevand Easel will convert it for you at compile time.saturationis a number between0and1, where0is grayscale and1is fully saturated.lightnessis a number between0and1, where0is black and1is white.alphais a number between0and1, where0is fully transparent and1is fully opaque. Defaults to1if not provided.
Returns undefined if the input is nullish.
color.HSL -> hue, saturation, lightness, alpha
Returns the hue, saturation, lightness and alpha components of a color.
hueis a number between0and360deg, where0degrepresents red. Like all angles in Easel, it is represented in radians, but you can use suffixes such asdegorrevand Easel will convert it for you at compile time.saturationis a number between0and1, where0is grayscale and1is fully saturated.lightnessis a number between0and1, where0is black and1is white.alphais a number between0and1, where0is fully transparent and1is fully opaque.
Returns all undefined if the input is nullish.
ImageSprite
this.ImageSprite<Id = auto>(image, [body], heading?=, bodyOffset?, screenOffset?, scale?,
color?, overlay?, repeatX?, repeatY?, [radius, angleOffset?,
audience?, bodyScale?, flicker?, frameInterval?, frameRepeat?,
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. Whenthisdespawns, the sprite is deleted. -
Id: A unique identifier for the sprite. If a sprite already exists onthiswith the sameId, the previous sprite will be deleted. -
image(Asset or Array): The image to display. Can either be a single asset, e.g.@fireball.png, or an array of frames, e.g.[@fireball1.png, @fireball2.png]or@fireball*.png(see Asset Wildcards). If you are using an array of frames, the sprite will cycle through the frames at the interval specified byframeInterval. -
frameInterval(Number): The number of ticks to wait before switching to the next frame. Defaults to0.1s. -
frameRepeat(Boolean): Iftrue, the sprite will loop through the frames. Defaults totrue. -
radius(Number): The radius of sprite, in game-world coordinates. -
scale(Number): The size of the sprite will be multiplied by this factor. Defaults to1. -
bodyScale(Number or Vector): The size of the sprite and itsbodyOffsetwill be multiplied by this factor. Width and height can be scaled independently by providing a Vector instead of a Number. Defaults to@(1, 1). -
repeatX(Number): The number of times to repeat the image along the x-axis. Defaults to1. -
repeatY(Number): The number of times to repeat the image along the y-axis. Defaults to1. -
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 ofPosition:AtPointer, the sprite will attach itself to the player's pointer. There are also a number of other symbolic values available, see Position for the full list. -
bodyOffset(Vector): If set, offsets the position of the sprite by this Vector.bodyOffsetwill be rotated to match the body's current heading. -
heading(Number or Entity): The direction that the sprite is facing. Normally this is determined frombody, but you can use this parameter to override it to either a fixed angle, or to match the heading of another Entity's body. -
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): Iftrue, the sprite will not rotate with the body. Defaults tofalse. -
strobe(Number or Boolean): A proportion between0and1which controls how much this sprite should Strobe with itsthisentity.truewill also be interpreted as1, andfalsewill be interpreted as0. Defaults to1. -
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-128and127(inclusive). Defaults to0. -
overlay(Number): When multiple sprites are attached to the same body, sprites with higheroverlaywill be drawn over the top of sprites with a loweroverlay. Must be a number between-128and127(inclusive). Defaults to0. -
audience(Entity, Symbol or Flag): If provided, only the specified audience can see the sprite. Defaults toAudience:All. See Audience. -
color(Color): If set, the image is tinted with this color. -
opacity(Number): A proportion between0and1where1means opaque and0means transparent. -
flicker(Number): A proportion between0and1which controls how much of a random color should be blended into thecolor. The random color changes on every frame, creating a flickering effect. -
owner(Entity): The player or team 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 between0and1. If set to a Boolean,trueis equivalent to1andfalseis equivalent to0. 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 exampleAlliance:Friendlywill mean only the owner and their allies will see the sprite in their owner color. -
luminous(Number): A proportion between0and1controlling how much the sprite adds rather than mixes its color with what is behind it. Settingluminousto1will make a sprite look like it is made of light. -
shine(Number): A proportion between0and1controlling 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 between0and1controlling 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 between0and1controlling the opacity of the drop shadow, where1makes 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. Whenthisdespawns, 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, Symbol or Flag): If provided, only the specified audience will see the aiming line. Defaults toowner. See Audience. -
owner(Entity): The player or team who owns the aiming line. Only used to interpret theaudienceparameter. -
priority(Number): Only the highest priority aiming line will be shown. Must be an integer between-128and127. Defaults to0. -
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 betweenbodyand the player'sPointer, multiplied by this number. Defaults to3. -
maxLength(Number): The maximum length of the line, in game-world coordinates. Defaults to100. -
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-128and127(inclusive). Defaults to0. -
diminish(Number): A proportion between0and1where1means itsshine,bloomAlphaandglareAlphawill diminish to zero as the line extends away frombody, while0means they will remain the same. This can be used to make the line look brighter at one end. Defaults to1. -
fade(Number or Color): If set to a Number, a proportion between0and1where1means it will fade to transparent as it extends away from thebody, while0means it will remain fully opaque. If set to a Color, the line will fade to that color as it extends away frombody. Defaults to1. -
taper(Number): A proportion between0and1where1means it will taper to a point as it extends away from thebody, while0means it will remain the same width. Defaults to0. -
color(Color): The color of the line. -
opacity(Number): A proportion between0and1where1means opaque and0means transparent. -
flicker(Number): A proportion between0and1which controls how much of a random color should be blended into thecolor. The random color changes on every frame, creating a flickering effect. -
luminous(Number): A proportion between0and1controlling how much the sprite adds rather than mixes its color with what is behind it, where1will add fully and will make the line look like it is made of light. -
shine(Number): A proportion between0and1controlling how much white to add to the line, making it look brighter. -
crater(Number): A proportion between0and1which determines the size of a transparent hole in the middle of the graphic. -
feather(Number): A proportion between0and1which determines the softness of the border of the line, where0means the border will be hard and1means the border will be soft. -
glare(Number): A proportion between0and1which determines the size of the glare. Glare makes the inside of the shape brighter, as if it is emitting light. A glare of1means the glare reaches the edge of the shape. -
glareAlpha(Number): A proportion between0and1controlling the intensity of the glare. A glareAlpha of1means 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 between0and1controlling the opacity of the bloom. -
shadow(Number): A proportion between0and1controlling the opacity of the drop shadow, where1makes a fully opaque shadow.
PolygonSprite
this.PolygonSprite<Id = auto>([shape, body], heading?=, angleOffset?, bodyOffset?, scale?,
screenOffset?, overlay?, image?, imageAnchor?, tile?, [audience?,
bloom?, bloomAlpha?, bodyScale?, color?, crater?, feather?,
flicker?, frameInterval?, frameRepeat?, 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. Whenthisdespawns, the sprite is deleted. -
Id: A unique identifier for the sprite. If a sprite already exists onthiswith the sameId, the previous sprite will be deleted. -
shape(Polygon): The shape of the sprite. -
scale(Number): The size of the sprite will be multiplied by this factor. Defaults to1. -
bodyScale(Number or Vector): The size of the sprite and itsbodyOffsetwill be multiplied by this factor. Width and height can be scaled independently by providing a Vector instead of a Number. Defaults to@(1, 1). -
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 to0.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 ofPosition:AtPointer, the sprite will attach itself to the player's pointer. There are also a number of other symbolic values available, see Position for the full list. -
heading(Number or Entity): The direction that the sprite is facing. Normally this is determined frombody, but you can use this parameter to override it to either a fixed angle, or to match the heading of another Entity's body. -
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. UnlikebodyOffset, this is done in screen space and so does not follow the rotation of the body. -
noRotation(Boolean): Iftrue, the sprite will not rotate with the body. Defaults tofalse. -
image(Asset or Array): If set, the sprite will be textured with this image. Can either be a single asset, e.g.@fireball.png, or an array of frames, e.g.[@fireball1.png, @fireball2.png]or@fireball*.png(see Asset Wildcards). If you are using an array of frames, the sprite will cycle through the frames at the interval specified byframeInterval. -
frameInterval(Number): The number of ticks to wait before switching to the next frame. Defaults to0.1s. -
frameRepeat(Boolean): Iftrue, the sprite will loop through the frames. Defaults totrue. -
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 between0and1which controls how much this sprite should Strobe with itsthisentity.truewill also be interpreted as1, andfalsewill be interpreted as0. Defaults to1. -
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-128and127(inclusive). Defaults to0. -
overlay(Number): When multiple sprites are attached to the same body, sprites with higheroverlaywill be drawn over the top of sprites with a loweroverlay. Must be a number between-128and127(inclusive). Defaults to0. -
audience(Entity, Symbol or Flag): If provided, the sprite will only be visible to the specified audience. Defaults toAudience:All. See Audience. -
color(Color): If set, the sprite is tinted with this color. -
opacity(Number): A proportion between0and1where1means opaque and0means transparent. -
flicker(Number): A proportion between0and1which controls how much of a random color should be blended into thecolor. The random color changes on every frame, creating a flickering effect. -
owner(Entity): The player or team 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 between0and1. If set to a Boolean,trueis equivalent to1andfalseis equivalent to0. 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 exampleAlliance:Friendlywill mean only the owner and their allies will see the sprite in their owner color. -
luminous(Number): A proportion between0and1controlling how much the sprite adds rather than mixes its color with what is behind it. Settingluminousto1will make a sprite look like it is made of light. -
shine(Number): A proportion between0and1controlling 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 between0and1which 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 between0and1which determines the softness of the border of the shape, where0means the border will be hard and1means the border will be soft. -
glare(Number): A proportion between0and1which determines the size of the glare. Glare makes the inside of the shape brighter, as if it is emitting light. A glare of1means the glare reaches the edge of the shape. -
glareAlpha(Number): A proportion between0and1controlling the intensity of the glare. A glareAlpha of1means 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 between0and1controlling the opacity of the bloom. -
shading(Number): A proportion between0and1controlling 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 between0and1controlling the opacity of the drop shadow, where1makes a fully opaque shadow.
R
color.R -> number
Returns the red component of a color as a value between 0 and 1.
Returns undefined if the input is nullish.
RGB
RGB(red, green, blue, alpha?) -> color
Returns a color comprised of the given red, green, blue and alpha components.
Each component should be a number between 0 and 1.
The alpha component defaults to 1 if not provided.
Returns undefined if the input is nullish.
color.RGB -> red, green, blue, alpha
Returns the red, green, blue and alpha components of a color.
Each component will be a value between 0 and 1.
Returns all undefined if the input is nullish.
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 inemunits.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:HighandResolution:Low. This function will returnundefinedif 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.
ShiftHue
color.ShiftHue(hueShift) -> color
Shifts the Hue of a color by the given amount and returns the result.
hueShiftshould be a number between-360and360, where0represents no change. Defaults to0if nullish.
The hue-shifting is done in the HSL color space.
If color is nullish, returns undefined.
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. Whenthisdespawns, 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-128and127. Defaults to0.audience(Entity, Symbol or Flag): If provided, the background is only visible to the specified audience. Defaults toowner. See Audience.owner(Entity): The player or team who owns the background. Only used to interpret theaudienceparameter.
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?, bodyScale?, 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 itsthisentity. Ifthisdespawns, the spark will continue to exist until it dissipates like normal. -
Id: The ID for the spark. Sparks with the samethisandIdwill be rendered together by the engine. This is done to improve performance. Certain fields, such aslayer, 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 between0and1which controls how much this sprite should Strobe with itsthisentity.truewill also be interpreted as1, andfalsewill be interpreted as0. Defaults to1. -
dissipate(Number): The number of ticks before the spark dissipates. Defaults to0.25s. -
audience(Entity, Symbol or Flag): If provided, the spark will only be visible to the specified audience. Defaults toAudience:All. See Audience. -
bodyOffset(Vector): An offset from thebodyposition where the spark should be spawned. This offset will be rotated to match the body's heading. -
screenOffset(Vector): An offset from thebodyposition where the spark should be spawned. -
glaze(Number or Bool): Iftrue, randomly offsets the position of the graphic to a random position within the Perimeter of the entity. If a Number, should be a proportion between0and1where1spawns the spark at a random point on the edge of the perimeter, while0spawns it in the center. -
velocity(Vector): The velocity of the spark. -
speed(Number): The speed of the spark. Ifspeedis set, the spark will move in a random direction at that speed. -
splatter(Number): A proportion between0and1which controls how much the spark should splatter. Splattering will primarily occur in the direction of velocity of thebodyEntity. 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-128and127(inclusive). Graphics on a higher layer will be drawn over the top of graphics on a lower layer. Defaults to0. -
radius(Number): The radius of the spark. -
bodyScale(Number): Both theradiusand thebodyOffsetof the spark will be scaled by this number. Defaults to1. -
crater(Number): A proportion between0and1which 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 between0and1which determines the softness of the border of the shape, where0means the border will be hard and1means the border will be soft. -
color(Color): The color of the spark. -
opacity(Number): A proportion between0and1where1means opaque and0means 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 between0and1where1means the spark will fade to transparent as it dissipates, while0means it will not fade at all. -
flicker(Number): A proportion between0and1which controls how much of a random color should be blended into thecolor. The random color changes on every frame, creating a flickering effect. -
luminous(Number): A proportion between0and1controlling how much the sprite adds rather than mixes its color with what is behind it. Settingluminousto1will make a spark look like it is made of light. -
shine(Number): A proportion between0and1controlling 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 between0and1. If set to a Boolean,trueis equivalent to1andfalseis equivalent to0. 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 exampleAlliance:Friendlywill mean only the owner and their allies will see the spark in their owner color. -
glare(Number): A proportion between0and1which determines the size of the glare. Glare makes the inside of the shape brighter, as if it is emitting light. A glare of1means the glare reaches the edge of the shape. -
glareAlpha(Number): A proportion between0and1controlling the intensity of the glare. A glareAlpha of1means 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 between0and1controlling the opacity of the bloom. -
shadow(Number): A proportion between0and1controlling the opacity of the drop shadow, where1makes a fully opaque shadow. -
diminish(Number): A proportion between0and1where1means itsshine,bloomAlphaandglareAlphawill diminish to zero as it dissipates, while0means they will remain the same. This can be used to make the line look brighter at one end. Defaults to1. -
taper(Number): A proportion between0and1where1means theradius,bloomandglarewill reduce to zero as it dissipates, while0means it will remain the same radius. Defaults to1.
Strand
this.Strand<Id = auto>([body], to, bodyOffset?=, screenOffset?, toBodyOffset?, toScreenOffset?,
[color, radius, audience?, bloom?, bloomAlpha?, bodyScale?,
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. Whenthisdespawns, this behavior is deleted. -
body(Entity, Vector or Symbol): The origin position of the strand, whether it be attached to an Entity's body, a fixed Vector position or a Position symbol. -
to(Entity, Vector or Symbol): The end position of the strand, whether it be attached to an Entity's body, a fixed Vector position or a Position symbol. -
bodyOffset(Vector): An offset from thebodyposition where the strand should be attached. This offset will be rotated to match the body's heading. -
screenOffset(Vector): An offset from thebodyposition where the strand should be attached. -
toBodyOffset(Vector): An offset from thetoposition where the strand should be attached. This offset will be rotated to match the body's heading. -
toScreenOffset(Vector): An offset from thetoposition where the strand should be attached. -
dissipate(Number): When thethisentity 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 (usingdelete Strand), it will disappear immediately. -
retract(Boolean): Iffalse(the default), the strand will retract to itstoposition as it dissipates. Iftrue, the strand will retract to itsbodyposition as it dissipates. -
audience(Entity, Symbol or Flag): If provided, the strand will only be visible to the specified audience. Defaults toAudience:All. See Audience. -
radius(Number): The radius of the strand. -
bodyScale(Number): The size of the strand will be multipled by this factor. Defaults to1. -
crater(Number): A proportion between0and1which 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 between0and1which determines the softness of the border of the shape, where0means the border will be hard and1means the border will be soft. -
layer(Number): The layer at which to draw the strand. Must be an integer between-128and127(inclusive). Graphics on a higher layer will be drawn over the top of graphics on a lower layer. Defaults to0. -
color(Color): The color of the strand. -
opacity(Number): A proportion between0and1where1means opaque and0means transparent. -
flicker(Number): A proportion between0and1which controls how much of a random color should be blended into thecolor. 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 between0and1where1means the strand will fade to transparent as it dissipates, while0means 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 between0and1. If set to a Boolean,trueis equivalent to1andfalseis equivalent to0. 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 exampleAlliance:Friendlywill mean only the owner and their allies will see the strand in their owner color. -
shine(Number): A proportion between0and1controlling how much white to add to the sprite, making it look brighter. -
luminous(Number): A proportion between0and1controlling how much the sprite adds rather than mixes its color with what is behind it. Settingluminousto1will make a strand look like it is made of light. -
strobe(Number or Boolean): A proportion between0and1which controls how much this sprite should Strobe with itsthisentity.truewill also be interpreted as1, andfalsewill be interpreted as0. -
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 between0and1controlling the opacity of the bloom. -
glare(Number): A proportion between0and1which determines the size of the glare. Glare makes the inside of the shape brighter, as if it is emitting light. A glare of1means the glare reaches the edge of the shape. -
glareAlpha(Number): A proportion between0and1controlling the intensity of the glare. A glareAlpha of1means the glare becomes fully white. -
shadow(Number): A proportion between0and1controlling the opacity of the drop shadow, where1makes a fully opaque shadow. -
taper(Number): A proportion between0and1where1means theradius,bloomandglarewill reduce to zero as it dissipates, while0means it will remain the same radius.
Streak
this.Streak<Id = auto>([body], bodyOffset?=, screenOffset?, [color, radius, audience?,
bloom?, bloomAlpha?, bodyScale?, 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, ifthisdespawns, 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): 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. -
bodyOffset(Vector): An offset to apply to all new streak points. Ifbodyis an Entity with a body, this offset will be rotated to match the current heading ofbody. -
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 to0.25s. -
audience(Entity, Symbol or Flag): If provided, only the specified audience will see the streak. Defaults toAudience:All. See Audience. -
radius(Number): The radius of the streak. -
bodyScale(Number): TheradiusandbodyOffsetwill be multiplied by this factor. Defaults to1. -
crater(Number): A proportion between0and1which determines the size of a transparent hole in the middle of the graphic. -
feather(Number): A proportion between0and1which determines the softness of the border of the shape, where0means the border will be hard and1means the border will be soft. -
layer(Number): The layer at which to draw the streak. Must be an integer between-128and127(inclusive). Graphics on a higher layer will be drawn over the top of graphics on a lower layer. Defaults to0. -
color(Color): The color of the streak. -
opacity(Number): A proportion between0and1where1means opaque and0means transparent. -
flicker(Number): A proportion between0and1which controls how much of a random color should be blended into thecolor. 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 between0and1. If set to a Boolean,trueis equivalent to1andfalseis equivalent to0. 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 exampleAlliance:Friendlywill mean only the owner and their allies will see the streak in their owner color. -
shine(Number): A proportion between0and1controlling how much white to add to the streak, making it look brighter. -
luminous(Number): A proportion between0and1controlling how much the streak adds rather than mixes its color with what is behind it. Settingluminousto1will make a streak look like it is made of light. -
strobe(Number or Boolean): A proportion between0and1which controls how much this streak should Strobe with itsthisentity.truewill also be interpreted as1, andfalsewill be interpreted as0. -
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 between0and1controlling the opacity of the bloom. -
glare(Number): A proportion between0and1which determines the size of the glare. Glare makes the inside of the shape brighter, as if it is emitting light. A glare of1means the glare reaches the edge of the shape. -
glareAlpha(Number): A proportion between0and1controlling the intensity of the glare. A glareAlpha of1means the glare becomes fully white. -
shadow(Number): A proportion between0and1controlling the opacity of the drop shadow, where1makes 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 between0and1where1means the streak will fade to transparent as it dissipates, while0means it will not fade at all. -
diminish(Number): A proportion between0and1where1means itsshine,bloomAlphaandglareAlphawill diminish to zero as it dissipates, while0means they will remain the same. This can be used to make the streak look brighter at one end. Defaults to1. -
taper(Number): A proportion between0and1where1means theradius,bloomandglarewill reduce to zero as it dissipates, while0means it will remain the same radius.
Strobe
this.Strobe<Id = auto>([dissipate?], fade?=, growth?, shine?, taper?)
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 samethisandId, it will be replaced.dissipate(Number): The duration of the strobe in ticks. Defaults to0.25s.fade(Number): Reduce the opacity of all graphics by this proportion. Should be a value between0and1. Defaults to0.growth(Number): A proportion of the growth to apply to all graphics. Defaults to0. A growth of0.5would make the graphics grow to1.5times their normal size temporarily.shine(Number): A proportion of shine to apply to all graphics. Should be a value between0and1. This is in addition to any shine already applied to the graphics. Defaults to0.taper(Number): A proportion between0and1indicating how much the strobe should taper off over time. A value of1(the default) means the strobe will taper off completely as it dissipates, whereas0means it will remain at full strength until the end of its duration.
Swoop
this.Swoop<Id = auto>([body], heading?=, bodyOffset?, screenOffset?, angleOffset?,
[color, length, audience?, bloom?, bloomAlpha?, bodyScale?,
crater?, diminish?, dissipate?, fade?, feather?, flicker?,
glare?, glareAlpha?, layer?, luminous?, 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, ifthisdespawns, 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, Vector or Symbol): The position of the swoop, whether it be attached to an Entity's body, a fixed Vector position, or a Position symbol. -
bodyOffset(Vector): Applies an offset tobodyposition. This will be rotated to match the current heading ofbody, unlessnoRotationis true. -
screenOffset(Vector): Applies an offset to thebodyposition. -
heading(Number or Entity): The heading of the swoop. Normally this is determined frombody, but you can use this parameter to override it. Provide either a Number to use a fixed angle, or an Entity to use the heading of that Entity. -
angleOffset(Number): This is added to theheadingof the swoop to calculate the direction of the swoop. Defaults to0. -
dissipate(Number): The number of ticks it takes for the swoop to dissipate. Defaults to0.25s. -
audience(Entity, Symbol or Flag): If provided, only the specified audience will see the swoop. Defaults toAudience:All. See Audience. -
length(Number): The length of the swoop, measured as the distance from the center of the body to the edge of the swoop. -
bodyScale(Number): Thelengthof the swoop and thebodyOffsetwill be multiplied by this number. Defaults to1. -
layer(Number): The layer at which to draw the swoop. Must be an integer between-128and127(inclusive). Graphics on a higher layer will be drawn over the top of graphics on a lower layer. Defaults to0. -
crater(Number): A proportion between0and1which 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 between0and1which determines the softness of the border of the shape, where0means the border will be hard and1means the border will be soft. -
color(Color): The color of the swoop. -
opacity(Number): A proportion between0and1where1means opaque and0means transparent. -
flicker(Number): A proportion between0and1which controls how much of a random color should be blended into thecolor. 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 between0and1. If set to a Boolean,trueis equivalent to1andfalseis equivalent to0. 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 exampleAlliance:Friendlywill mean only the owner and their allies will see the swoop in their owner color. -
strobe(Number or Boolean): A proportion between0and1which controls how much this swoop should Strobe with itsthisentity.truewill also be interpreted as1, andfalsewill be interpreted as0. -
shine(Number): A proportion between0and1controlling how much white to add to the swoop, making it look brighter. -
luminous(Number): A proportion between0and1controlling how much the swoop adds rather than mixes its color with what is behind it. Settingluminousto1will 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 between0and1controlling the opacity of the bloom. -
glare(Number): A proportion between0and1which determines the size of the glare. Glare makes the inside of the shape brighter, as if it is emitting light. A glare of1means the glare reaches the edge of the shape. -
glareAlpha(Number): A proportion between0and1controlling the intensity of the glare. A glareAlpha of1means 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 between0and1where1means the swoop will fade to transparent as it dissipates, while0means it will not fade at all. -
diminish(Number): A proportion between0and1where1means itsshine,bloomAlphaandglareAlphawill diminish to zero as it dissipates, while0means they will remain the same. This can be used to make the swoop look brighter at one end. Defaults to1. -
taper(Number): A proportion between0and1where1means theradius,bloomandglarewill reduce to zero as it dissipates, while0means it will remain the same radius. Defaults to0(no tapering).
TextSprite
this.TextSprite<Id = auto>(text, [body], heading?=, angleOffset?, bodyOffset?, screenOffset?,
scale?, overlay?, widthPx?, heightPx?, anchorTop?, anchorBottom?,
[audience?, bodyScale?, 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. Whenthisdespawns, the sprite is deleted. -
Id: A unique identifier for the sprite. If a sprite already exists onthiswith the sameId, the previous sprite will be deleted. -
text(String): The text to display. -
widthPx(Number),heightPx(Number) andradius(Number): Defines the size of the label. EitherheightPxorradiusmust be set.widthPxandheightPxspecify 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,radiusdefines 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. -
scale(Number): The size of the sprite will be multiplied by this factor. Defaults to1. -
bodyScale(Number or Vector): The size of the sprite and itsbodyOffsetwill be multiplied by this factor. Width and height can be scaled independently by providing a Vector instead of a Number. Defaults to@(1, 1). -
bodyOffset(Vector): If set, offsets the position of the sprite by this Vector.bodyOffsetwill 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 totrue, the top of the label will be the anchor point, and the text will be placed below that. -
anchorBottom(Boolean): If set totrue, 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 ofPosition:AtPointer, the sprite will attach itself to the player's pointer. There are also a number of other symbolic values available, see Position for the full list. -
heading(Number or Entity): The direction that the sprite is facing. Normally this is determined frombody, but you can use this parameter to override it to either a fixed angle, or to match the heading of another Entity's body. -
noRotation(Boolean): Iftrue, the sprite will not rotate with the body. Defaults tofalse. -
strobe(Number or Boolean): A proportion between0and1which controls how much this sprite should Strobe with itsthisentity.truewill also be interpreted as1, andfalsewill be interpreted as0. Defaults to1. -
layer(Number): The layer of the sprite. Must be an integer between-128and127(inclusive). Graphics on a higher layer will be drawn over the top of graphics on a lower layer. Defaults to0. -
overlay(Number): When multiple sprites are attached to the same body, sprites with higheroverlaywill be drawn over the top of sprites with a loweroverlay. Must be a number between-128and127(inclusive). Defaults to0. -
audience(Entity, Symbol or Flag): If provided, the sprite will only be visible to the specified audience. Defaults toAudience:All. See Audience. -
color(Color): The color of the text. Defaults to white. -
opacity(Number): A proportion between0and1where1means opaque and0means transparent. -
flicker(Number): A proportion between0and1which controls how much of a random color should be blended into thecolor. 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 between0and1. If set to a Boolean,trueis equivalent to1andfalseis equivalent to0. 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 exampleAlliance:Friendlywill mean only the owner and their allies will see the sprite in their owner color. -
luminous(Number): A proportion between0and1controlling how much the sprite adds rather than mixes its color with what is behind it. Settingluminousto1will make a sprite look like it is made of light. -
shine(Number): A proportion between0and1controlling 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. Whenthisdespawns, this behavior is deleted. -
color(Color): The color of the vignette. Defaults to#000000. -
opacity(Number): The opacity of the vignette. Defaults to1. -
power(Number): Controls how quickly the vignette fades away with distance from the edge. Larger numbers make the vignette fade away more quickly. Defaults to4. -
priority(Number): Only the highest priority vignette will be shown. Must be an integer between-128and127. Defaults to0. -
audience(Entity, Symbol or Flag): If provided, only the specified audience will see the vignette. Defaults toowner. See Audience. -
owner(Entity): The player who owns the vignette. Only used to interpret theaudienceparameter.
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.