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?, maxScreenSizePx?, stencil?,
acquireRate?, transitionRate?, priority?, [audience?, owner?,
camera?])
delete this.Camera<Id?>
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. -
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. -
transitionRate(Number): The rate at which the camera transitions from its current position to the target position, where1is instant and0is never. A value of0.25means the camera will move 25% of the way to its target position each frame. Defaults to1. -
acquireRate(Number): Overrides the initial value oftransitionRate. Once the camera has reached the target, the camera reverts to usingtransitionRate. This allows you to smoothly transition to find the target initially, and then remain fully locked to it once the target has been reached. Defaults tonull(no override). -
stencil(Boolean): Iftrue, the camera will only render inside the areas defined by any stencil components such as PolygonStencil. Iffalse, the camera will render everything, ignoring any stencils. If nullish, will default totrueif any stencil components are present for the camera, orfalseotherwise. -
camera(Entity or Array of Entities): Determines which camera(s) will have its target position set. Defaults toWorld(the main camera). -
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.
Deprecated parameters:
aspectRatio: This parameter has now been moved to Viewport. It will still be accepted here for legacy reasons, but may be removed in a future update.
CameraBoundary
this.CameraBoundary<Id = auto>(left?=, right?, top?, bottom?, priority?, [audience?, owner?,
camera?])
delete this.CameraBoundary<Id>
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. If the camera's radius is too big, the camera will also be forced to zoom in order to fit within the 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(Number): If supplied, the leftmost boundary of the camera. -
right(Number): If supplied, the rightmost boundary of the camera. -
top(Number): If supplied, the topmost boundary of the camera. -
bottom(Number): 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. -
camera(Entity or Array of Entities): Determines which camera(s) will have its boundaries set. Defaults toWorld(the main camera).
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.
- fullscreen (Boolean):
trueto enter fullscreen mode,falseto exit.
FullscreenToggle
FullscreenToggle([ui=]) |use ui:whenFullscreen, use ui:whenWindowed| { }
Creates an element in the user interface that allows the player to switch between fullscreen and windowed mode.
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 as there are defaults for both fullscreen and windowed states.
Use the %ui:whenFullscreen { ... } syntax to populate one of the slots,
see Multiple Slots for more information.
ui:whenFullscreen(UI): populate this slot with the content that should be displayed when fullscreen. If left empty, will display a default button that will exit fullscreen mode.ui:whenWindowed(UI): populate this slot with the content that should be displayed when windowed. If left empty, will display a default button that will enter fullscreen mode.
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.
ImageSpark
this.ImageSpark<Id = auto>(image, [body, radius=], heading?, bodyOffset?, screenOffset?,
angleOffset?, scale?, speed?, velocity?, acceleration?, turnRate?,
repeatX?, repeatY?, [audience?, bodyScale?, camera?, color?,
crater?, diminish?, dissipate?, fade?, feather?, flicker?,
frameInterval?, frameRepeat?, glare?, glareAlpha?, glaze?,
layer?, luminous?, noRotation?, opacity?, owner?, ownerColor?,
shading?, shadow?, shine?, splatter?, strobe?, taper?])
Creates a spark particle in a given Polygon shape that dissipates over time.
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 last spark determines the value of these fields for the entire group.
Image:
-
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. -
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 to1. -
repeatY(Number): The number of times to repeat the image along the y-axis. Defaults to1. -
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.
Position:
-
body(Entity or Vector): The position of the spark, whether it be spawned at an Entity's body or at a specific Vector position. -
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. -
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.
Scaling:
scale(Number or Vector): The size of the sprite will be multiplied by this factor. Width and height can be scaled independently by providing a Vector instead of a Number. 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 to1.
Z-order:
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.
Color:
-
color(Color): The color of 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. -
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. -
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. -
glare(Number): A proportion between0and1which determines the size of the glare. Glare makes the inside of the sprite brighter, as if it is emitting light. A glare of1means the glare reaches the edge of the sprite. -
glareAlpha(Number): A proportion between0and1controlling the intensity of the glare. A glareAlpha of1means the glare becomes fully white. -
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. -
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.
Effects:
-
crater(Number): A proportion between0and1which determines the size of a transparent hole in the middle of the sprite. This is useful for creating circular indicators, for example. -
feather(Number): A proportion between0and1which determines the softness of the border of the sprite, where0means the border will be hard and1means the border will be soft. -
shadow(Number): A proportion between0and1controlling the opacity of the drop shadow, where1makes a fully opaque shadow.
Blending:
-
opacity(Number): A proportion between0and1where1means opaque and0means transparent. -
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 rather than paint.
Dissipation:
-
dissipate(Number): The number of ticks before the spark dissipates. Defaults to0.25s. -
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. -
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 thescale,bloomandglarewill reduce to zero as it dissipates, while0means it will remain the same radius. Defaults to1.
Trajectory:
-
velocity(Vector): The spark will move in the speed and direction determined by this parameter. Defaults to@(0, 0). -
speed(Number): The spark will move at this speed in a random direction. If bothvelocityandspeedare specified, their effects will be added together. Defaults to0. -
acceleration(Vector): The spark's velocity will change at this rate per second. Set toacceleration=Gravityto make the spark fall at the speed of gravity. Defaults to@(0, 0). -
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. -
turnRate(Number): The spark will be rotated by this amount per second.
Viewers:
-
audience(Entity, Symbol or Flag): If provided, the spark will only be visible to the specified audience. Defaults toAudience:All. See Audience. -
owner(Entity): The player entity that owns the spark. -
camera(Entity or Array of Entities): Determines which camera(s) will render the spark. Defaults toWorld(the main camera).
ImageSprite
this.ImageSprite<Id = auto>(image, [body, radius=], heading?, bodyOffset?, screenOffset?,
angleOffset?, scale?, color?, overlay?, repeatX?, repeatY?,
[audience?, bodyScale?, camera?, crater?, feather?, flicker?,
frameInterval?, frameRepeat?, glare?, glareAlpha?, 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 replaced.
Image:
-
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. -
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 to1. -
repeatY(Number): The number of times to repeat the image along the y-axis. Defaults to1. -
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.
Position:
-
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. -
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. -
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. -
noRotation(Boolean): Iftrue, the sprite will not rotate with the body. Defaults tofalse.
Scaling:
scale(Number or Vector): The size of the sprite will be multiplied by this factor. Width and height can be scaled independently by providing a Vector instead of a Number. Mirror a sprite around the Y-axis by using@(-1, 1). 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 to1.
Z-order:
-
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.
Color:
-
color(Color): If set, the image is tinted with this color. -
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. -
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. -
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. -
glare(Number): A proportion between0and1which determines the size of the glare. Glare makes the inside of the sprite brighter, as if it is emitting light. A glare of1means the glare reaches the edge of the sprite. -
glareAlpha(Number): A proportion between0and1controlling the intensity of the glare. A glareAlpha of1means the glare becomes fully white. -
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. -
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.
Effects:
-
crater(Number): A proportion between0and1which determines the size of a transparent hole in the middle of the sprite. This is useful for creating circular indicators, for example. -
feather(Number): A proportion between0and1which determines the softness of the border of the sprite, where0means the border will be hard and1means the border will be soft. -
shadow(Number): A proportion between0and1controlling the opacity of the drop shadow, where1makes a fully opaque shadow.
Blending:
-
opacity(Number): A proportion between0and1where1means opaque and0means transparent. -
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 rather than paint.
Viewers:
-
audience(Entity, Symbol or Flag): If provided, only the specified audience can see the sprite. Defaults toAudience:All. See Audience. -
owner(Entity): The player or team entity that owns the sprite. -
camera(Entity or Array of Entities): Determines which camera(s) will render the sprite. Defaults toWorld(the main camera).
ImageStencil
this.ImageStencil<Id = auto>(image, [body], heading?=, bodyOffset?, screenOffset?, scale?,
repeatX?, repeatY?, [radius, angleOffset?, audience?, bodyScale?,
camera?, crater?, frameInterval?, frameRepeat?, noRotation?,
owner?])
delete this.ImageStencil<Id>
Limits rendering to the area inside an image. See Stencils for more information.
this(Entity): Defines the lifespan of the stencil. Whenthisdespawns, the stencil is deleted.Id: A unique identifier for the stencil. If a stencil already exists onthiswith the sameId, the previous stencil will be replaced.
Image:
-
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 stencil will cycle through the frames at the interval specified byframeInterval. -
radius(Number): The radius of stencil, in game-world coordinates. -
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. -
frameInterval(Number): The number of ticks to wait before switching to the next frame. Defaults to0.1s. -
frameRepeat(Boolean): Iftrue, the stencil will loop through the frames. Defaults totrue.
Position:
-
body(Entity, Vector or Symbol): The position of the stencil, whether it is attached to an Entity's body or fixed at a Vector position. If given the special symbolic value ofPosition:AtPointer, the stencil 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 stencil by this Vector.bodyOffsetwill be rotated to match the body's current heading. -
heading(Number or Entity): The direction that the stencil 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 stencil by this Vector. -
angleOffset(Number): If set, the stencil image will be rotated by this angle, expressed in radians. This is in addition to the rotation of the body. -
noRotation(Boolean): Iftrue, the stencil will not rotate with the body. Defaults tofalse.
Scaling:
scale(Number or Vector): The size of the sprite will be multiplied by this factor. Width and height can be scaled independently by providing a Vector instead of a Number. 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 to1.
Effects:
crater(Number): A proportion between0and1which determines the size of a transparent hole in the middle of the stencil.
Viewers:
-
audience(Entity, Symbol or Flag): If provided, only the specified audience can see the stencil. Defaults toAudience:All. See Audience. -
owner(Entity): The player or team entity that owns the stencil. -
camera(Entity or Array of Entities): Determines which camera(s) will render the stencil. Defaults toWorld(the main camera).
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<Id?>([body], priority?=, lengthMultiplier?, maxLength?, diminish?,
fade?, taper?, [radius, owner?, audience?, camera?, flicker?,
shadow?, bloom?, bloomAlpha?, color?, crater?, feather?, glare?,
glareAlpha?, layer?, luminous?, opacity?, shine?])
delete this.PointerAimingLine<Id?>
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 rather than paint. -
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. -
camera(Entity or Array of Entities): Determines which camera(s) will render the line. Defaults toWorld(the main camera).
PolygonSpark
this.PolygonSpark<Id = auto>([shape, body], heading?=, bodyOffset?, screenOffset?, angleOffset?,
scale?, speed?, velocity?, acceleration?, turnRate?, image?,
imageAnchor?, imageOffset?, imageRadius?, tile?, [audience?,
bloom?, bloomAlpha?, bodyScale?, camera?, color?, crater?,
diminish?, dissipate?, fade?, feather?, flicker?, frameInterval?,
frameRepeat?, glare?, glareAlpha?, glaze?, layer?, luminous?,
noRotation?, opacity?, owner?, ownerColor?, shading?, shadow?,
shine?, splatter?, strobe?, taper?])
Creates a spark particle in a given Polygon shape that dissipates over time.
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 last spark determines the value of these fields for the entire group.
Shape:
shape(Polygon): The shape of the sprite.
Position:
-
body(Entity or Vector): The position of the spark, whether it be spawned at an Entity's body or at a specific Vector position. -
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. -
glaze(Number or Bool): Iftrue, randomly offsets the position of the sprite 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.
Scaling:
scale(Number or Vector): The size of the sprite will be multiplied by this factor. Width and height can be scaled independently by providing a Vector instead of a Number. 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 to1.
Z-order:
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.
Texture:
-
image(Asset or Array): If set, the sprite will be textured with this image. The image will be clipped so it only appears within theshape. 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 point of the image will be placed at the sprite origin. Defaults to@(0, 0), which places the center of the image at the sprite origin. A value of@(-1, -1)would place the top left corner of the image at the sprite origin, whereas@(1, 1)would place the bottom right corner of the image at the sprite origin. -
imageOffset(Vector): Displaces the image by this amount in world coordinates. -
imageRadius(Number): Determines the size of the image, in world coordinates. Defaults to the the bounding radius of theshape. -
tile(Boolean or Number): Iftrue, a repeating pattern of the image will be drawn to fill the shape. A Number can be provided as a shorthand to both set theimageRadiusto the given value and enable tiling at the same time.
Color:
-
color(Color): The color of 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. -
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. -
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. -
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. -
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. -
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.
Effects:
-
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. -
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. -
shadow(Number): A proportion between0and1controlling the opacity of the drop shadow, where1makes a fully opaque shadow.
Blending:
-
opacity(Number): A proportion between0and1where1means opaque and0means transparent. -
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 rather than paint.
Dissipation:
-
dissipate(Number): The number of ticks before the spark dissipates. Defaults to0.25s. -
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. -
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 thescale,bloomandglarewill reduce to zero as it dissipates, while0means it will remain the same radius. Defaults to1.
Trajectory:
-
velocity(Vector): The spark will move in the speed and direction determined by this parameter. Defaults to@(0, 0). -
speed(Number): The spark will move at this speed in a random direction. If bothvelocityandspeedare specified, their effects will be added together. Defaults to0. -
acceleration(Vector): The spark's velocity will change at this rate per second. Set toacceleration=Gravityto make the spark fall at the speed of gravity. Defaults to@(0, 0). -
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. -
turnRate(Number): The spark will be rotated by this amount per second.
Viewers:
-
audience(Entity, Symbol or Flag): If provided, the spark will only be visible to the specified audience. Defaults toAudience:All. See Audience. -
owner(Entity): The player entity that owns the spark. -
camera(Entity or Array of Entities): Determines which camera(s) will render the spark. Defaults toWorld(the main camera).
PolygonSprite
this.PolygonSprite<Id = auto>([shape, body], heading?=, angleOffset?, bodyOffset?, scale?,
screenOffset?, overlay?, image?, imageAnchor?, imageOffset?,
imageRadius?, tile?, [audience?, bloom?, bloomAlpha?, bodyScale?,
camera?, color?, crater?, feather?, flicker?, frameInterval?,
frameRepeat?, glare?, glareAlpha?, layer?, luminous?, noRotation?,
opacity?, owner?, ownerColor?, shading?, shadow?, shine?,
strobe?])
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 replaced.
Shape:
shape(Polygon): The shape of the sprite.
Position:
-
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.
Scaling:
-
scale(Number or Vector): The size of the sprite will be multiplied by this factor. Width and height can be scaled independently by providing a Vector instead of a Number. 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 to1.
Z-order:
-
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.
Texture:
-
image(Asset or Array): If set, the sprite will be textured with this image. The image will be clipped so it only appears within theshape. 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 point of the image will be placed at the sprite origin. Defaults to@(0, 0), which places the center of the image at the sprite origin. A value of@(-1, -1)would place the top left corner of the image at the sprite origin, whereas@(1, 1)would place the bottom right corner of the image at the sprite origin. -
imageOffset(Vector): Displaces the image by this amount in world coordinates. -
imageRadius(Number): Determines the size of the image, in world coordinates. Defaults to the the bounding radius of theshape. -
tile(Boolean or Number): Iftrue, a repeating pattern of the image will be drawn to fill the shape. A Number can be provided as a shorthand to both set theimageRadiusto the given value and enable tiling at the same time.
Color:
-
color(Color): If set, the sprite is tinted with this color. -
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. -
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. -
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. -
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. -
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. -
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.
Effects:
-
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. -
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. -
shadow(Number): A proportion between0and1controlling the opacity of the drop shadow, where1makes a fully opaque shadow.
Blending:
-
opacity(Number): A proportion between0and1where1means opaque and0means transparent. -
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 rather than paint.
Viewers:
-
audience(Entity, Symbol or Flag): If provided, the sprite will only be visible to the specified audience. Defaults toAudience:All. See Audience. -
owner(Entity): The player or team entity that owns the sprite. -
camera(Entity or Array of Entities): Determines which camera(s) will render the sprite. Defaults toWorld(the main camera).
PolygonStencil
this.PolygonStencil<Id = auto>([shape, body], heading?=, angleOffset?, bodyOffset?, scale?,
screenOffset?, image?, imageAnchor?, imageOffset?, imageRadius?,
tile?, [audience?, bodyScale?, camera?, crater?, frameInterval?,
frameRepeat?, noRotation?, owner?])
delete this.PolygonStencil<Id>
Limits rendering to the area inside a polygon. See Stencils for more information.
this(Entity): Defines the lifespan of the stencil. Whenthisdespawns, the stencil is deleted.Id: A unique identifier for the stencil. If a stencil already exists onthiswith the sameId, the previous stencil will be replaced.
Shape:
shape(Polygon): The shape of the stencil.
Position:
-
body(Entity, Vector or Symbol): The position of the stencil, whether it be attached to an Entity's body or fixed at a Vector position. If given the special symbolic value ofPosition:AtPointer, the stencil 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 stencil 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 stencil will be rotated by this angle. -
bodyOffset(Vector): If set, determines the attachment point of the stencil on the body. -
screenOffset(Vector): If set, offsets the position of the stencil by this Vector. UnlikebodyOffset, this is done in screen space and so does not follow the rotation of the body. -
noRotation(Boolean): Iftrue, the stencil will not rotate with the body. Defaults tofalse.
Scaling:
-
scale(Number or Vector): The size of the stencil will be multiplied by this factor. Width and height can be scaled independently by providing a Vector instead of a Number. Defaults to1. -
bodyScale(Number or Vector): The size of the stencil and itsbodyOffsetwill be multiplied by this factor. Width and height can be scaled independently by providing a Vector instead of a Number. Defaults to1.
Texture:
-
image(Asset or Array): If set, the stencil will be textured with this image. Opaque parts of the image will allow the camera to be rendered, whereas transparent parts of the image will be stenciled out of the camera. The image will be clipped so it only appears within theshape. 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 stencil 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 stencil will loop through the frames. Defaults totrue. -
imageAnchor(Vector): Designates which point of the image will be placed at the stencil origin. Defaults to@(0, 0), which places the center of the image at the stencil origin. A value of@(-1, -1)would place the top left corner of the image at the stencil origin, whereas@(1, 1)would place the bottom right corner of the image at the stencil origin. -
imageOffset(Vector): Displaces the image by this amount in world coordinates. -
imageRadius(Number): Determines the size of the image, in world coordinates. Defaults to the the bounding radius of theshape. -
tile(Boolean or Number): Iftrue, a repeating pattern of the image will be drawn to fill the shape. A Number can be provided as a shorthand to both set theimageRadiusto the given value and enable tiling at the same time.
Effects:
crater(Number): A proportion between0and1which determines the size of a hole in the middle of the polygonshape.
Viewer:
-
audience(Entity, Symbol or Flag): If provided, the stencil will only apply to the specified audience. Defaults toAudience:All. See Audience. -
owner(Entity): The player or team entity that owns the stencil. Used to interpret theaudienceparameter. -
camera(Entity or Array of Entities): Determines which camera(s) will be affected by the stencil. Defaults toWorld(the main camera).