Layer – Keep information about a single layer of graphics

class _stage.Layer(width, height, graphic, palette[, grid])

Keep internal information about a layer of graphics (either a Grid or a Sprite) in a format suitable for fast rendering with the render() function.

Parameters:
  • width (int) – The width of the grid in tiles, or 1 for sprites.
  • height (int) – The height of the grid in tiles, or 1 for sprites.
  • graphic (bytearray) – The graphic data of the tiles.
  • palette (bytearray) – The color palette to be used.
  • grid (bytearray) – The contents of the grid map.

This class is intended for internal use in the stage library and it shouldn’t be used on its own.

move(x, y)

Set the offset of the layer to the specified values.

frame(frame, rotation)

Set the animation frame of the sprite, and optionally rotation its graphic.