Cauldron2D.Parallax.Strip (Cauldron2D v0.2.2)

Copy Markdown View Source

A cell function over authored tiles, wrapping in one or both directions.

rows = Cauldron2D.Parallax.Strip.legend(["..#..", "#####"], %{"#" => :brick, "." => :void})
Cauldron2D.Parallax.Strip.cells(rows, wrap: :x)

Row 0 of the tiles is tile row 0 of the layer. A coordinate outside the tiles on an axis that does not wrap is :void.

Summary

Functions

Build the cell function over rows, a list of equal-length rows of cells.

Rows of cells from rows of characters, each character looked up in legend.

Types

art()

@type art() :: term()

cell()

@type cell() :: :void | {art(), [art()], nil}

wrap()

@type wrap() :: :both | :x | :y | :none

Functions

cells(rows, opts \\ [])

@spec cells([[cell()]], keyword()) :: ({integer(), integer()} -> cell())

Build the cell function over rows, a list of equal-length rows of cells.

Options

  • :wrap — :both, :x, :y or :none. Default :both

legend(lines, legend)

@spec legend([String.t()], %{required(String.t()) => art() | cell()}) :: [[cell()]]

Rows of cells from rows of characters, each character looked up in legend.