Module artlayer

Art layer related variables and functions.

Functions

drawStamp (stamp, x, y, scaleX, scaleY, rotation) Renders a given stamp to the art layer using a given translation, scaling, and rotation.
drawSprite (sprite, x, y, scaleX, scaleY, rotation) Renders a given sprite to the art layer using a given translation, scaling, and rotation.
setPixel (x, y, color) Sets the ARGB value (alpha and color) of the pixel at the given coordinate.
setRect (x, y, width, height, color) Sets the ARGB value (alpha and color) of the pixels within the given rectangle.
destroy () Destroys the art layer, removing it from the level.
clear () Clears the art layer, emptying its contents without destroying the layer.

Fields

depth The depth of the art layer.
layerNum The layerNum of the art layer (equivalent to the ">" icon in Level Editor).
alpha The alpha of the art layer, represented by a number in the range of 0 - 1.
blendMode The blend mode of the art layer.
destroyed Whether or not the art layer was destroyed.


Functions

drawStamp (stamp, x, y, scaleX, scaleY, rotation)
Renders a given stamp to the art layer using a given translation, scaling, and rotation.

Parameters:

  • stamp stamp The sprite to render to the art layer.
  • x number By how many pixels along the x-axis to move the stamp when rendering to the art layer. By default 0.
  • y number By how many pixels along the y-axis to move the stamp when rendering to the art layer. By default 0.
  • scaleX number By how much to scale the stamp along the x-axis when rendering to the art layer. By default 1.
  • scaleY number By how much to scale the stamp along the y-axis when rendering to the art layer. By default 1.
  • rotation number By how many degrees to rotate the stamp when rendering to the art layer. By default 0

See also:

drawSprite (sprite, x, y, scaleX, scaleY, rotation)
Renders a given sprite to the art layer using a given translation, scaling, and rotation.

Parameters:

  • sprite sprite The sprite to render to the art layer.
  • x number By how many pixels along the x-axis to move the sprite when rendering to the art layer. By default 0.
  • y number By how many pixels along the y-axis to move the sprite when rendering to the art layer. By default 0.
  • scaleX number By how much to scale the sprite along the x-axis when rendering to the art layer. By default 1.
  • scaleY number By how much to scale the sprite along the y-axis when rendering to the art layer. By default 1.
  • rotation number By how many degrees to rotate the sprite when rendering to the art layer. By default 0.

See also:

setPixel (x, y, color)
Sets the ARGB value (alpha and color) of the pixel at the given coordinate.

Parameters:

  • x int The x-coordinate of the pixel.
  • y int The y-coordinate of the pixel.
  • color int The ARGB value of the pixel. The simplest way to calculate this is with the 0xAARRGGBB hex format, where AA is the hex value from 0 - 255 for the alpha, RR for red, GG for green, and BB for blue.

Usage:

    someLayer.setPixel(10, 10, 0xFF00FF00) -- Sets the pixel at (10, 10) to fully opaque green.
setRect (x, y, width, height, color)
Sets the ARGB value (alpha and color) of the pixels within the given rectangle.

Parameters:

  • x int The x-coordinate of the top left corner of the rectangle.
  • y int The y-coordinate of the top left corner of the rectangle.
  • width int The width of the rectangle.
  • height int The height of the rectangle.
  • color int The ARGB value of the pixel. The simplest way to calculate this is with the 0xAARRGGBB hex format, where AA is the hex value from 0 - 255 for the alpha, RR for red, GG for green, and BB for blue.

Usage:

    someLayer.setPixel(10, 10, 0xFF00FF00) -- Sets the pixel at (10, 10) to fully opaque green.
destroy ()
Destroys the art layer, removing it from the level. Once destroyed, no operations on the layer will function.
clear ()
Clears the art layer, emptying its contents without destroying the layer.

Fields

depth
The depth of the art layer. By default 1.
layerNum
The layerNum of the art layer (equivalent to the ">" icon in Level Editor). By default 1. Greater layerNum layers are drawn above lesser layerNum layers, regardless of layer depth. layerNums of 2 or greater draw above blocks. 3 or greater draws above players, hats, projectiles, and other visual effects.
alpha
The alpha of the art layer, represented by a number in the range of 0 - 1. An alpha of 0 means the layer is completely transparent; 1 means fully visible. By default 1.
blendMode
The blend mode of the art layer. By default "normal". Valid blend modes are defined here, although not all are guaranteed to have any effect when used by art layers: https://airsdk.dev/reference/actionscript/3.0/flash/display/BlendMode.html
destroyed
Whether or not the art layer was destroyed. Calling destroy sets this to true. Read-only.
generated by LDoc 1.5.0 Last updated 2024-07-10 03:22:35