Cauldron2D.GameMaker.Room.Layer (Cauldron2D.GameMaker v0.2.1)

Copy Markdown View Source

A layer of a GameMaker Studio 2 room. Layers draw in order of depth, greater first; offset {x, y} shifts everything on the layer and speed {x, y} scrolls it by that many pixels a step.

content depends on the layer's kind:

  • {:background, map} — sprite sprite (-1 for a plain fill of colour) drawn from first_frame at animation {rate, :per_second | :per_frame}, tiled {across, down}, stretched to the room, or in front of everything as a foreground
  • {:instances, ids} — the ids of the room's instances drawn on this layer
  • {:assets, map} — tiles, a list of Cauldron2D.GameMaker.Room.Tile cut from sprites, and sprites, each a map of sprite, position, scale, colour, animation, frame and rotation
  • {:tiles, map} — a grid size {columns, rows} of cells from tileset tileset; cells is a tuple of rows, each a tuple of cells. A cell is nil when empty, otherwise {tile, flags} where flags lists any of :mirror, :flip and :rotate
  • {:unknown, kind} — a kind this reader does not take apart (effects, paths)

Summary

Functions

The layer at at.

Types

cell()

@type cell() :: {non_neg_integer(), [:mirror | :flip | :rotate]} | nil

t()

@type t() :: %Cauldron2D.GameMaker.Room.Layer{
  content: {atom(), term()},
  depth: integer(),
  id: non_neg_integer(),
  name: String.t(),
  offset: {number(), number()},
  speed: {number(), number()},
  visible: boolean()
}

Functions

read(data, at)

@spec read(binary(), non_neg_integer()) :: t()

The layer at at.