Graphics
These functions relate to rendering graphics on the screen, such as sprites, particles and text. See Learn > Graphics for a broader overview of how graphics work in Easel.
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.
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.
ImageSpark
this.ImageSpark<Id = auto>(image, [body, radius=], heading?, face?, billboard?, bodyOffset?, screenOffset?, angleOffset?, scale?, speed?, velocity?, acceleration?, turnRate?, imageAnchor?, 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?, sharp?, 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. -
sharp(Boolean): Iftrue, will preserve the pixelation of the image by using neearest neighbor interpolation. This can be used to make pixel art games. Defaults tofalse.
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. -
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. -
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.
Orientation:
-
noRotation(Boolean): If truthy, stops the sprite from rotating with the body. Same as settingheading=0rev. -
heading(Number, Vector or Entity): Determines the heading of the sprite, which affects both the sprite's rotation and itsbodyOffset.- Number: specifies the angle, e.g.
0rev,0.25rev,-0.5rev - Vector: derives the angle from the direction of the vector, e.g.
@(1, 0),@(-1, 1) - Entity: matches the heading of the given entity
- If not specified, the sprite will follow the heading of the
body.
- Number: specifies the angle, e.g.
-
face(Vector or Entity): Sets theheadingof the sprite such that it points towards the given position. Affects both the sprite's rotation and itsbodyOffset.- Vector: the sprite will face towards the given world-space position, e.g.
@(12, 34),@(-78, 46) - Entity: the sprite will face towards the given entity's position
- Vector: the sprite will face towards the given world-space position, e.g.
-
billboard(Boolean): Iftrue, the sprite's rotation will locked to the camera's orientation, so it always appears upright. -
angleOffset(Number): An additional offset to apply to the sprite's rotation, e.g.0.25revfor a quarter turn. Defaults to0rev.
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 which determines the softness of the border of the sprite, where0means the border will be hard and1means the border will be soft. A positive value (between0and1) will feather the outside of the sprite, while a negative value (between-1and0) will feather the inside. -
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?, face?, billboard?, bodyOffset?, screenOffset?, angleOffset?, scale?, color?, overlay?, imageAnchor?, repeatX?, repeatY?, [audience?, bodyScale?, camera?, crater?, feather?, flicker?, frameInterval?, frameRepeat?, glare?, glareAlpha?, layer?, luminous?, noRotation?, opacity?, owner?, ownerColor?, shading?, sharp?, 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. -
sharp(Boolean): Iftrue, will preserve the pixelation of the image by using nearest neighbor interpolation. This can be used to make pixel art games. Defaults tofalse.
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. -
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. -
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.
Orientation:
-
noRotation(Boolean): If truthy, stops the sprite from rotating with the body. Same as settingheading=0rev. -
heading(Number, Vector or Entity): Determines the heading of the sprite, which affects both the sprite's rotation and itsbodyOffset.- Number: specifies the angle, e.g.
0rev,0.25rev,-0.5rev - Vector: derives the angle from the direction of the vector, e.g.
@(1, 0),@(-1, 1) - Entity: matches the heading of the given entity
- If not specified, the sprite will follow the heading of the
body.
- Number: specifies the angle, e.g.
-
face(Vector or Entity): Sets theheadingof the sprite such that it points towards the given position. Affects both the sprite's rotation and itsbodyOffset.- Vector: the sprite will face towards the given world-space position, e.g.
@(12, 34),@(-78, 46) - Entity: the sprite will face towards the given entity's position
- Vector: the sprite will face towards the given world-space position, e.g.
-
billboard(Boolean): Iftrue, the sprite's rotation will locked to the camera's orientation, so it always appears upright. -
angleOffset(Number): An additional offset to apply to the sprite's rotation, e.g.0.25revfor a quarter turn. Defaults to0rev.
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 which determines the softness of the border of the sprite, where0means the border will be hard and1means the border will be soft. A positive value (between0and1) will feather the outside of the sprite, while a negative value (between-1and0) will feather the inside. -
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?=, face?, billboard?, bodyOffset?, screenOffset?, scale?, imageAnchor?, 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. -
screenOffset(Vector): If set, offsets the position of the stencil by this Vector.
Orientation:
-
noRotation(Boolean): If truthy, stops the stencil from rotating with the body. Same as settingheading=0rev. -
heading(Number, Vector or Entity): Determines the heading of the stencil, which affects both the stencil's rotation and itsbodyOffset.- Number: specifies the angle, e.g.
0rev,0.25rev,-0.5rev - Vector: derives the angle from the direction of the vector, e.g.
@(1, 0),@(-1, 1) - Entity: matches the heading of the given entity
- If not specified, the stencil will follow the heading of the
body.
- Number: specifies the angle, e.g.
-
face(Vector or Entity): Sets theheadingof the stencil such that it points towards the given position. Affects both the stencil's rotation and itsbodyOffset.- Vector: the stencil will face towards the given world-space position, e.g.
@(12, 34),@(-78, 46) - Entity: the stencil will face towards the given entity's position
- Vector: the stencil will face towards the given world-space position, e.g.
-
billboard(Boolean): Iftrue, the stencil's rotation will locked to the camera's orientation, so it always appears upright. -
angleOffset(Number): An additional offset to apply to the stencil's rotation, e.g.0.25revfor a quarter turn. Defaults to0rev.
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).
PointerAimingLine
this.PointerAimingLine<Id = auto>([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 which determines the softness of the border of the sprite, where0means the border will be hard and1means the border will be soft. A positive value (between0and1) will feather the outside of the sprite, while a negative value (between-1and0) will feather the inside. -
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).
PolygonHotspot
this.PolygonHotspot<Id = auto>(intent?, [shape, body], heading?=, face?, billboard?, angleOffset?, bodyOffset?, scale?, screenOffset?, growth?, rotate?, shift?, shine?, [bodyScale?, layer?, noRotation?, tolerance?, audience?, owner?, camera?])
delete this.PolygonHotspot<Id>
Creates a hotspot within the game world which the player can click on. This can be used to make things clickable, selectable or hoverable within the game world.
Hotspots do not have any graphics by themselves,
but when the player hovers a hotspot with their mouse, the sprites will Strobe.
By default, it will act like Strobe(growth=0.05, shine=0.1), but this can be customized, either
by passing in parameters directly into this function,
or globally in the [graphics] section of easel.toml.
The mouse pointer will also be changed to indicate the player can interact with the hotspot.
this(Entity): Defines the lifespan of the hotspot. Whenthisdespawns, the hotspot is deleted.Id: A unique identifier for the hotspot. If a hotspot already exists onthiswith the sameId, the previous hotspot will be replaced.
Intent:
intent(Intent/Keycode or Array of Intent/Keycodes): The action to take when the hotspot is pressed.null(the default) means no action. The most common intent is a PressIntent. If provided a Keycode, the hotspot will simulate a press of that key when clicked. It is possible to provide an array of multiple intents, which will be executed in order. Unlike a Button, a hotspot cannot accept a String intent to take the player to an external website when clicked, and so if you provide a String intent, it will be ignored. See Intents to learn more.
Shape:
-
shape(Polygon): The shape of the hotspot. -
tolerance(Number): Some shapes may need to be approximated in order to perform efficient overlap detection. 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.25.
Position:
-
body(Entity, Vector or Symbol): The position of the hotspot, whether it be attached to an Entity's body or fixed at a Vector position. There are also a number of other symbolic values available, see Position for the full list. -
bodyOffset(Vector): If set, determines the attachment point of the hotspot on the body. -
screenOffset(Vector): If set, offsets the position of the hotspot by this Vector. UnlikebodyOffset, this is done in screen space and so does not follow the rotation of the body.
Orientation:
-
noRotation(Boolean): If truthy, stops the hotspot from rotating with the body. Same as settingheading=0rev. -
heading(Number, Vector or Entity): Determines the heading of the hotspot, which affects both the hotspot's rotation and itsbodyOffset.- Number: specifies the angle, e.g.
0rev,0.25rev,-0.5rev - Vector: derives the angle from the direction of the vector, e.g.
@(1, 0),@(-1, 1) - Entity: matches the heading of the given entity
- If not specified, the hotspot will follow the heading of the
body.
- Number: specifies the angle, e.g.
-
face(Vector or Entity): Sets theheadingof the hotspot such that it points towards the given position. Affects both the hotspot's rotation and itsbodyOffset.- Vector: the hotspot will face towards the given world-space position, e.g.
@(12, 34),@(-78, 46) - Entity: the hotspot will face towards the given entity's position
- Vector: the hotspot will face towards the given world-space position, e.g.
-
billboard(Boolean): Iftrue, the hotspot's rotation will locked to the camera's orientation, so it always appears upright. -
angleOffset(Number): An additional offset to apply to the hotspot's rotation, e.g.0.25revfor a quarter turn. Defaults to0rev.
Scaling:
-
scale(Number or Vector): The size of the hotspot 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 hotspot 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 hotspot. If two hotspots overlap, hotspots on higher layers will be take precedence over hotspots on lower layers. Must be a number between-128and127(inclusive). Defaults to0.
Strobe:
These parameters decide what should happen when the player hovers over the hotspot. They act like a Strobe, temporarily modifying all graphics on the entity.
-
growth(Number or Vector): A proportion of the growth to apply to all graphics when the hotspot is hovered over. Defaults to0. A growth of0.5would make the graphics grow to1.5times their normal size temporarily. Provide a Vector instead of a Number to perform non-uniform scaling, e.g.@(0.5, 0)will make the graphics 50% bigger in the X direction only. -
rotate(Number): An angle to rotate all the sprites around their body when the hotspot is hovered over. Defaults to0rev. -
shift(Vector): All graphics will be offset by this amount on screen when the hotspot is hovered over. Defaults to@(0, 0). -
shine(Number): A proportion between0and1controlling how much white to add to the sprites when the hotspot is hovered over, making them look brighter.
Viewers:
-
audience(Entity, Symbol or Flag): If provided, only the specified audience will be able to see and interact with the hotspot. Defaults toowner. See Audience. -
owner(Entity): The player or team entity that owns the hotspot. Used as the default value foraudience. -
camera(Entity or Array of Entities): Determines the camera(s) for which the hotspot will apply. Defaults toWorld(the main camera).
PolygonSpark
this.PolygonSpark<Id = auto>([shape, body], heading?=, face?, billboard?, 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?, sharp?, 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. -
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. -
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.
Orientation:
-
noRotation(Boolean): If truthy, stops the sprite from rotating with the body. Same as settingheading=0rev. -
heading(Number, Vector or Entity): Determines the heading of the sprite, which affects both the sprite's rotation and itsbodyOffset.- Number: specifies the angle, e.g.
0rev,0.25rev,-0.5rev - Vector: derives the angle from the direction of the vector, e.g.
@(1, 0),@(-1, 1) - Entity: matches the heading of the given entity
- If not specified, the sprite will follow the heading of the
body.
- Number: specifies the angle, e.g.
-
face(Vector or Entity): Sets theheadingof the sprite such that it points towards the given position. Affects both the sprite's rotation and itsbodyOffset.- Vector: the sprite will face towards the given world-space position, e.g.
@(12, 34),@(-78, 46) - Entity: the sprite will face towards the given entity's position
- Vector: the sprite will face towards the given world-space position, e.g.
-
billboard(Boolean): Iftrue, the sprite's rotation will locked to the camera's orientation, so it always appears upright. -
angleOffset(Number): An additional offset to apply to the sprite's rotation, e.g.0.25revfor a quarter turn. Defaults to0rev.
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(Number or Boolean): If a Number, the image will be tiled (repeated horizontally and vertically), withtiledetermining the radius of each tile. Iftrue, the image will be tiled, usingimageRadiusas the tile radius. -
sharp(Boolean): Iftrue, will preserve the pixelation of the image by using neearest neighbor interpolation. This can be used to make pixel art games. Defaults tofalse.
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 which determines the softness of the border of the sprite, where0means the border will be hard and1means the border will be soft. A positive value (between0and1) will feather the outside of the sprite, while a negative value (between-1and0) will feather the inside. -
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?=, face?, billboard?, 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?, sharp?, 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. -
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.
Orientation:
-
noRotation(Boolean): If truthy, stops the sprite from rotating with the body. Same as settingheading=0rev. -
heading(Number, Vector or Entity): Determines the heading of the sprite, which affects both the sprite's rotation and itsbodyOffset.- Number: specifies the angle, e.g.
0rev,0.25rev,-0.5rev - Vector: derives the angle from the direction of the vector, e.g.
@(1, 0),@(-1, 1) - Entity: matches the heading of the given entity
- If not specified, the sprite will follow the heading of the
body.
- Number: specifies the angle, e.g.
-
face(Vector or Entity): Sets theheadingof the sprite such that it points towards the given position. Affects both the sprite's rotation and itsbodyOffset.- Vector: the sprite will face towards the given world-space position, e.g.
@(12, 34),@(-78, 46) - Entity: the sprite will face towards the given entity's position
- Vector: the sprite will face towards the given world-space position, e.g.
-
billboard(Boolean): Iftrue, the sprite's rotation will locked to the camera's orientation, so it always appears upright. -
angleOffset(Number): An additional offset to apply to the sprite's rotation, e.g.0.25revfor a quarter turn. Defaults to0rev.
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(Number or Boolean): If a Number, the image will be tiled (repeated horizontally and vertically), withtiledetermining the radius of each tile. Iftrue, the image will be tiled, usingimageRadiusas the tile radius. -
sharp(Boolean): Iftrue, will preserve the pixelation of the image by using neearest neighbor interpolation. This can be used to make pixel art games. Defaults tofalse.
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 which determines the softness of the border of the sprite, where0means the border will be hard and1means the border will be soft. A positive value (between0and1) will feather the outside of the sprite, while a negative value (between-1and0) will feather the inside. -
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?=, face?, billboard?, 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. -
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.
Orientation:
-
noRotation(Boolean): If truthy, stops the stencil from rotating with the body. Same as settingheading=0rev. -
heading(Number, Vector or Entity): Determines the heading of the stencil, which affects both the stencil's rotation and itsbodyOffset.- Number: specifies the angle, e.g.
0rev,0.25rev,-0.5rev - Vector: derives the angle from the direction of the vector, e.g.
@(1, 0),@(-1, 1) - Entity: matches the heading of the given entity
- If not specified, the stencil will follow the heading of the
body.
- Number: specifies the angle, e.g.
-
face(Vector or Entity): Sets theheadingof the stencil such that it points towards the given position. Affects both the stencil's rotation and itsbodyOffset.- Vector: the stencil will face towards the given world-space position, e.g.
@(12, 34),@(-78, 46) - Entity: the stencil will face towards the given entity's position
- Vector: the stencil will face towards the given world-space position, e.g.
-
billboard(Boolean): Iftrue, the stencil's rotation will locked to the camera's orientation, so it always appears upright. -
angleOffset(Number): An additional offset to apply to the stencil's rotation, e.g.0.25revfor a quarter turn. Defaults to0rev.
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(Number or Boolean): If a Number, the image will be tiled (repeated horizontally and vertically), withtiledetermining the radius of each tile. Iftrue, the image will be tiled, usingimageRadiusas the tile radius.
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).
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.
- 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 Multiple Slots 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.
ShadowOffset
ShadowOffset -> vector
Gets the global shadow offset.
Defaults to @(0, 0.5) unless otherwise set.
Any sprite that uses the shadow parameter will display a shadow with this screen offset.
The initial shadow offset value is determined by the shadow parameter in the [graphics] section of easel.toml.
ShadowOffset = value
Sets the global shadow offset. Must be a Vector.
await ShadowOffset -> vector
Waits for the global shadow offset to change, then returns its new value.
SolidBackground
this.SolidBackground<Id = auto>(color, luminous?=, priority?, audience?, [owner?, camera?])
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. -
luminous(Number): A proportion between0and1controlling how much the background adds rather than mixes its color with what is behind it. Settingluminousto1will make the background look like it is made of light rather than paint. This parameter is only useful if you have multiple cameras layered on top of each other. Defaults to0. -
priority(Number): For each camera, only the highest priority background for that camera 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. -
camera(Entity or Array of Entities): Determines which camera(s) will display this background. Defaults toWorld(the main camera).
delete this.SolidBackground<Id>
Deletes a previously-assigned solid background behavior from this Entity.
Spark
this.Spark<Id = auto>([body], bodyOffset?=, screenOffset?, speed?, velocity?, acceleration?, [color, radius, audience?, bloom?, bloomAlpha?, bodyScale?, camera?, crater?, diminish?, dissipate?, fade?, feather?, flicker?, glare?, glareAlpha?, glaze?, layer?, luminous?, opacity?, owner?, ownerColor?, shading?, 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 last spark determines the value of these fields for the entire group. -
radius(Number): The radius of the spark.
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. -
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.
Scaling:
bodyScale(Number): Both theradiusand thebodyOffsetof the spark will be scaled by this 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 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.
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 which determines the softness of the border of the sprite, where0means the border will be hard and1means the border will be soft. A positive value (between0and1) will feather the outside of the sprite, while a negative value (between-1and0) will feather the inside. -
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 theradius,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.
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).
Strand
this.Strand<Id = auto>([body], to, bodyOffset?=, screenOffset?, toBodyOffset?, toScreenOffset?, [color, radius, audience?, bloom?, bloomAlpha?, bodyScale?, camera?, 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. -
Id(String): The ID for the strand. This is used to distinguish between different strands on the same entity. -
radius(Number): The radius of the strand.
Position:
-
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.
Scaling:
bodyScale(Number): The radius of the strand will be multipled by this factor. Defaults to1.
Z-order:
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(Color): The color of 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. -
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. -
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.
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 which determines the softness of the border of the sprite, where0means the border will be hard and1means the border will be soft. A positive value (between0and1) will feather the outside of the sprite, while a negative value (between-1and0) will feather the inside. -
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 strand look like it is made of light rather than paint.
Dissipation:
-
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. -
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. -
taper(Number): A proportion between0and1where1means theradius,bloomandglarewill reduce to zero as it dissipates, while0means it will remain the same radius.
Viewer:
-
audience(Entity, Symbol or Flag): If provided, the strand will only be visible to the specified audience. Defaults toAudience:All. See Audience. -
owner(Entity): The player entity that owns the strand. -
camera(Entity or Array of Entities): Determines which camera(s) will render the strand. Defaults toWorld(the main camera).
Streak
this.Streak<Id = auto>([body], bodyOffset?=, screenOffset?, [color, radius, audience?, bloom?, bloomAlpha?, bodyScale?, camera?, crater?, diminish?, dissipate?, fade?, feather?, flicker?, glare?, glareAlpha?, layer?, luminous?, opacity?, owner?, ownerColor?, shadow?, shine?, strobe?, taper?])
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. -
radius(Number): The radius of the streak.
Position:
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.
Scaling:
bodyScale(Number): TheradiusandbodyOffsetwill be multiplied by this factor. Defaults to1.
Z-order:
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(Color): The color of 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. -
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 streak, making it look brighter. -
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 streak should Strobe with itsthisentity.truewill also be interpreted as1, andfalsewill be interpreted as0.
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. -
feather(Number): A proportion which determines the softness of the border of the sprite, where0means the border will be hard and1means the border will be soft. A positive value (between0and1) will feather the outside of the sprite, while a negative value (between-1and0) will feather the inside. -
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 streak adds rather than mixes its color with what is behind it. Settingluminousto1will make a streak look like it is made of light rather than paint.
Dissipation:
-
dissipate(Number): The number of ticks it takes for the streak to dissipate. Defaults to0.25s. -
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.
Viewers:
-
audience(Entity, Symbol or Flag): If provided, only the specified audience will see the streak. Defaults toAudience:All. See Audience. -
owner(Entity): The player entity that owns the streak. -
camera(Entity or Array of Entities): Determines which camera(s) will render the streak. Defaults toWorld(the main camera).
delete this.Streak<Id>
Ends an existing streak. Any new points will begin a new streak, unconnected to the previous streak. The old streak will dissipate as normal.
this(Entity): Defines the entity that owns the streak.Id: The ID for the streak. Provide the same ID as the one used to create the streak.
Strobe
this.Strobe<Id = auto>([dissipate?], swell?=, fade?, growth?, rotate?, scale?, shift?, shine?, taper?)
delete this.Strobe<Id>
Temporarily modifies the graphics attached to this for a short duration.
This can be used to create hit flashes, shaking effects, invincibility flashing, or other 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.
Duration:
dissipate(Number): The duration of the strobe in ticks. Defaults to0.25s.
Effects:
-
fade(Number): Reduce the opacity of all graphics by this proportion. Should be a value between0and1. Defaults to0. -
growth(Number or Vector): 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. Provide a Vector instead of a Number to perform non-uniform scaling, e.g.@(0.5, 0)will make the graphics 50% bigger in the X direction only. -
shift(Vector): Offsets the graphics along the screen axes (like a temporaryscreenOffset). Defaults to@(0, 0). -
shine(Number): A proportion between0and1controlling how much white to add to the sprites, making them look brighter. -
rotate(Number): An angle to rotate all the sprites around their body. Defaults to0rev.
Animation:
-
swell(Number): A proportion between0and1indicating how much time it should take for the strobe to reach its maximum. A value of0means it begins at maximum straight away, whereas1means it takes its whole duration to grow to maximum. 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?, camera?, crater?, diminish?, dissipate?, fade?, feather?, flicker?, glare?, glareAlpha?, layer?, luminous?, opacity?, owner?, ownerColor?, shadow?, shine?, strobe?, taper?])
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. -
length(Number): The length of the swoop, measured as the distance from the center of the body to the edge of the swoop.
Position:
-
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.
Scaling:
bodyScale(Number): Thelengthof the swoop and thebodyOffsetwill be multiplied by this number. Defaults to1.
Z-order:
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.
Color:
-
color(Color): The color of 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. -
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 swoop, making it look brighter. -
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 swoop should Strobe with itsthisentity.truewill also be interpreted as1, andfalsewill be interpreted as0.
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 starting from the origin of the sector and extending to the edge of the swoop. -
feather(Number): A proportion which determines the softness of the border of the sprite, where0means the border will be hard and1means the border will be soft. A positive value (between0and1) will feather the outside of the sprite, while a negative value (between-1and0) will feather the inside.
Blending:
-
opacity(Number): A proportion between0and1where1means opaque and0means transparent. -
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 rather than paint.
Dissipation:
-
dissipate(Number): The number of ticks it takes for the swoop to dissipate. Defaults to0.25s. -
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).
Viewers:
-
audience(Entity, Symbol or Flag): If provided, only the specified audience will see the swoop. Defaults toAudience:All. See Audience. -
owner(Entity): The player entity that owns the swoop. -
camera(Entity or Array of Entities): Determines which camera(s) will render the sprite. Defaults toWorld(the main camera).
delete this.Swoop<Id>
Ends an existing swoop. Any new swoops will begin a new swoop, unconnected to the previous swoop.
this(Entity): Defines the entity that owns the swoop.Id(String): The ID for the swoop. Provide the same ID as the one used to create the swoop.
TextSpark
this.TextSpark<Id = auto>(text, [body], heading?=, face?, billboard?, angleOffset?, bodyOffset?, screenOffset?, scale?, speed?, velocity?, acceleration?, turnRate?, fontSize?, align?, vAlign?, font?, bold?, italic?, stroke?, strokeAlpha?, [audience?, bodyScale?, camera?, color?, crater?, diminish?, dissipate?, fade?, feather?, flicker?, glare?, glareAlpha?, glaze?, layer?, luminous?, noRotation?, opacity?, owner?, ownerColor?, radius?, shading?, shadow?, shine?, splatter?, strobe?, taper?])
Creates a spark particle which displays the given text and 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. -
text(String): The text to display.
Font size:
Choose one of the following methods to define the size of the text:
-
radius(Number): Defines the radius (half the height) of the text sprite in world units. This parameter lets you size the text sprite in a similar way to other sprites in your game world. -
fontSize(Number): The size of the font in em units. This parameter lets you size the text the similar to other UI elements. A font size of1is the normal size for body text on the user's screen, whereas2would be twice as large.
Font style:
-
font(Font): The font to use. -
bold(Boolean): Iftrue, the text will be drawn in bold. -
italic(Boolean): Iftrue, the text will be drawn in italics. -
stroke(Number or Boolean): Determines the width of the outline around the text. Should be a value between0and1, where0means no stroke and1is the maximum size. Iftrueis provided, uses the default value of0.2. -
strokeAlpha(Number): A proportion between0and1which controls how dark the stroke color is, where0is the same as the textcolorand1means fully black. Defaults to1.
Text alignment:
-
align(Symbol):Align:Center(the default) centers the text horizontally on the sprite's origin.Align:Leftaligns the left of the text with the sprite's origin.Align:Rightaligns the right of the text with the sprite's origin. -
vAlign(Symbol):VAlign:Middle(the default) centers the text vertically on the sprite's origin.VAlign:Topaligns the top of the text with the sprite's origin.VAlign:Bottomaligns the bottom of the text with the sprite's origin.
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. -
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. -
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.
Orientation:
-
noRotation(Boolean): If truthy, stops the sprite from rotating with the body. Same as settingheading=0rev. -
heading(Number, Vector or Entity): Determines the heading of the sprite, which affects both the sprite's rotation and itsbodyOffset.- Number: specifies the angle, e.g.
0rev,0.25rev,-0.5rev - Vector: derives the angle from the direction of the vector, e.g.
@(1, 0),@(-1, 1) - Entity: matches the heading of the given entity
- If not specified, the sprite will follow the heading of the
body.
- Number: specifies the angle, e.g.
-
face(Vector or Entity): Sets theheadingof the sprite such that it points towards the given position. Affects both the sprite's rotation and itsbodyOffset.- Vector: the sprite will face towards the given world-space position, e.g.
@(12, 34),@(-78, 46) - Entity: the sprite will face towards the given entity's position
- Vector: the sprite will face towards the given world-space position, e.g.
-
billboard(Boolean): Iftrue, the sprite's rotation will locked to the camera's orientation, so it always appears upright. -
angleOffset(Number): An additional offset to apply to the sprite's rotation, e.g.0.25revfor a quarter turn. Defaults to0rev.
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 sprite, 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 which determines the softness of the border of the sprite, where0means the border will be hard and1means the border will be soft. A positive value (between0and1) will feather the outside of the sprite, while a negative value (between-1and0) will feather the inside. -
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 itsshineandglareAlphawill 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 thescaleandglarewill 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).
TextSprite
this.TextSprite<Id = auto>(text, [body], heading?=, face?, billboard?, angleOffset?, bodyOffset?, screenOffset?, scale?, overlay?, fontSize?, heightPx?, align?, vAlign?, font?, bold?, italic?, stroke?, strokeAlpha?, [audience?, bodyScale?, camera?, 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 text 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. -
text(String): The text to display.
Font size:
Choose one of the following methods to define the size of the text:
-
radius(Number): Defines the radius (half the height) of the text sprite in world units. This parameter lets you size the text sprite in a similar way to other sprites in your game world. -
fontSize(Number): The size of the font in em units. This parameter lets you size the text the similar to other UI elements. A font size of1is the normal size for body text on the user's screen, whereas2would be twice as large.
Font style:
-
font(Font): The font to use. -
bold(Boolean): Iftrue, the text will be drawn in bold. -
italic(Boolean): Iftrue, the text will be drawn in italics. -
stroke(Number or Boolean): Determines the width of the outline around the text. Should be a value between0and1, where0means no stroke and1is the maximum size. Iftrueis provided, uses the default value of0.2. -
strokeAlpha(Number): A proportion between0and1which controls how dark the stroke color is, where0is the same as the textcolorand1means fully black. Defaults to1.
Text alignment:
-
align(Symbol):Align:Center(the default) centers the text horizontally on the sprite's origin.Align:Leftaligns the left of the text with the sprite's origin.Align:Rightaligns the right of the text with the sprite's origin. -
vAlign(Symbol):VAlign:Middle(the default) centers the text vertically on the sprite's origin.VAlign:Topaligns the top of the text with the sprite's origin.VAlign:Bottomaligns the bottom of the text with the sprite's origin.
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. -
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.
Orientation:
-
noRotation(Boolean): If truthy, stops the sprite from rotating with the body. Same as settingheading=0rev. -
heading(Number, Vector or Entity): Determines the heading of the sprite, which affects both the sprite's rotation and itsbodyOffset.- Number: specifies the angle, e.g.
0rev,0.25rev,-0.5rev - Vector: derives the angle from the direction of the vector, e.g.
@(1, 0),@(-1, 1) - Entity: matches the heading of the given entity
- If not specified, the sprite will follow the heading of the
body.
- Number: specifies the angle, e.g.
-
face(Vector or Entity): Sets theheadingof the sprite such that it points towards the given position. Affects both the sprite's rotation and itsbodyOffset.- Vector: the sprite will face towards the given world-space position, e.g.
@(12, 34),@(-78, 46) - Entity: the sprite will face towards the given entity's position
- Vector: the sprite will face towards the given world-space position, e.g.
-
billboard(Boolean): Iftrue, the sprite's rotation will locked to the camera's orientation, so it always appears upright. -
angleOffset(Number): An additional offset to apply to the sprite's rotation, e.g.0.25revfor a quarter turn. Defaults to0rev.
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 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.
Color:
-
color(Color): The color of the text. Defaults to white. -
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. -
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 which determines the softness of the border of the sprite, where0means the border will be hard and1means the border will be soft. A positive value (between0and1) will feather the outside of the sprite, while a negative value (between-1and0) will feather the inside. -
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 entity that owns the sprite.camera(Entity or Array of Entities): Determines which camera(s) will render the sprite. Defaults toWorld(the main camera).
Deprecated parameters:
heightPx(Number): UsefontSizeinstead to specify the height inemunits, as they are relative to the user's chosen font size and so scale better across different screen sizes and resolutions.
The following parameters have been deprecated in favor of the more flexible vAlign parameter:
anchorTop(Boolean): Iftrue, setsvAligntoVAlign:Top.anchorBottom(Boolean): Iftrue, setsvAligntoVAlign:Bottom.
TextStencil
this.TextStencil<Id = auto>(text, [body], heading?=, face?, billboard?, angleOffset?, bodyOffset?, screenOffset?, scale?, overlay?, fontSize?, align?, vAlign?, font?, bold?, italic?, stroke?, strokeAlpha?, [audience?, bodyScale?, camera?, color?, crater?, feather?, flicker?, glare?, glareAlpha?, layer?, luminous?, noRotation?, opacity?, owner?, ownerColor?, radius?, shading?, shadow?, shine?, strobe?])
delete this.TextStencil<Id>
Limits rendering to the area of a given text shape. 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. -
text(String): The text to display.
Font size:
Choose one of the following methods to define the size of the text:
-
radius(Number): Defines the radius (half the height) of the text stencil in world units. This parameter lets you size the text stencil in a similar way to other sprites in your game world. -
fontSize(Number): The size of the font in em units. This parameter lets you size the text the similar to other UI elements. A font size of1is the normal size for body text on the user's screen, whereas2would be twice as large.
Font style:
-
font(Font): The font to use. -
bold(Boolean): Iftrue, the text will be drawn in bold. -
italic(Boolean): Iftrue, the text will be drawn in italic. -
stroke(Number or Boolean): Determines the width of the outline around the text. Should be a value between0and1, where0means no stroke and1is the maximum size. Iftrueis provided, uses the default value of0.2. -
strokeAlpha(Number): A proportion between0and1which controls how dark the stroke color is, where0is the same as the textcolorand1means fully black. Defaults to1.
Text alignment:
-
align(Symbol):Align:Center(the default) centers the text horizontally on the stencil's origin.Align:Leftaligns the left of the text with the stencil's origin.Align:Rightaligns the right of the text with the stencil's origin. -
vAlign(Symbol):VAlign:Middle(the default) centers the text vertically on the stencil's origin.VAlign:Topaligns the top of the text with the stencil's origin.VAlign:Bottomaligns the bottom of the text with the stencil's origin.
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. -
screenOffset(Vector): If set, offsets the position of the stencil by this Vector.
Orientation:
-
noRotation(Boolean): If truthy, stops the stencil from rotating with the body. Same as settingheading=0rev. -
heading(Number, Vector or Entity): Determines the heading of the stencil, which affects both the stencil's rotation and itsbodyOffset.- Number: specifies the angle, e.g.
0rev,0.25rev,-0.5rev - Vector: derives the angle from the direction of the vector, e.g.
@(1, 0),@(-1, 1) - Entity: matches the heading of the given entity
- If not specified, the stencil will follow the heading of the
body.
- Number: specifies the angle, e.g.
-
face(Vector or Entity): Sets theheadingof the stencil such that it points towards the given position. Affects both the stencil's rotation and itsbodyOffset.- Vector: the stencil will face towards the given world-space position, e.g.
@(12, 34),@(-78, 46) - Entity: the stencil will face towards the given entity's position
- Vector: the stencil will face towards the given world-space position, e.g.
-
billboard(Boolean): Iftrue, the stencil's rotation will locked to the camera's orientation, so it always appears upright. -
angleOffset(Number): An additional offset to apply to the stencil's rotation, e.g.0.25revfor a quarter turn. Defaults to0rev.
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.
Effects:
crater(Number): A proportion between0and1which determines the size of a hole in the middle of the stencil.
Viewers:
-
audience(Entity, Symbol or Flag): If provided, the stencil will only be visible to the specified audience. Defaults toAudience:All. See Audience. -
owner(Entity): The player entity that owns the stencil. -
camera(Entity or Array of Entities): Determines which camera(s) will render the sprite. Defaults toWorld(the main camera).
Vignette
this.Vignette<Id = auto>(color?=, luminous?, opacity?, power?, layer?, priority?, audience?, [owner?, camera?])
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 and Fill:
-
color(Color): The color of the vignette. Defaults to#000000. -
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.
Blending:
-
luminous(Number): A proportion between0and1controlling how much the vignette adds rather than mixes its color with what is behind it. Settingluminousto1will make the background look like it is made of light rather than paint. Defaults to0. -
opacity(Number): The opacity of the vignette. Defaults to1.
Z-order:
layer(Number): The rendering layer of the vignette. Sprites on higher layers will be drawn over the top of sprites on lower layers. Must be a number between-128and127(inclusive). Defaults to127(draw the vignette on top of everything).
Viewer:
-
priority(Number): Optional. If not provided, the vignette will always be drawn. If provided, it will only be drawn if it is the highest priority vignette for its camera. Must be an integer between-128and127. Defaults tonull(always draw). -
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. -
camera(Entity or Array of Entities): Determines which camera(s) will render the vignette. Defaults toWorld(the main camera).
delete this.Vignette<Id>
Deletes a previously-assigned vignette behavior.