Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Layer

Layers support different kinds of data, specifically:

Visit https://ldtk.io/docs/general/editor-components/layers/ for more information about layers.

Hierarchy

  • Layer

Index

Constructors

constructor

Properties

Private autoLayerTiles_

autoLayerTiles_: null | Tile[] = null

Private entities_

entities_: null | Entity[] = null

Private gridTiles_

gridTiles_: null | Tile[] = null

Readonly intGridValues

intGridValues: Readonly<Record<number, IntGridValueDef>> = ...

A map of IntGrid values to IntGrid value definitions.

The definition contains the editor color and optional identifier.

This is only populated if Layer.type is IntGrid.

Private intGrid_

intGrid_: null | number[][] = null

Private Optional tileset_

tileset_: undefined | Tileset

Readonly world

world: World

Accessors

autoLayerTiles

  • get autoLayerTiles(): null | readonly Tile[]

entities

  • get entities(): null | readonly Entity[]

gridSize

  • get gridSize(): number
  • Size of a grid cell.

    Refers to both the width and height.

    Returns number

gridTiles

  • get gridTiles(): null | readonly Tile[]

intGrid

  • get intGrid(): null | readonly number[][]
  • This contains the values from the IntGrid, but stored in a 2D array.

    const layer: Layer = new Layer(...);
    const grid = layer.intGridXY;
    for (let x = 0; x < grid.length; ++x) {
        for (let y = 0; y < grid[x].length; ++y) {
            doSomethingWith(grid[x][y]);
        }
    }
    

    Non-null if this.type === "IntGrid"

    Layer.type

    Returns null | readonly number[][]

level

  • get level(): undefined | Level

opacity

  • get opacity(): number

pxTotalOffset

  • get pxTotalOffset(): Point
  • Total layer pixel offset, including both instance and definition offsets.

    Returns Point

size

tileset

  • get tileset(): undefined | Tileset
  • Optional tileset used to render the layer

    Returns undefined | Tileset

type

  • Layer type, possible values: AutoLayer, Entities, Tiles, IntGrid

    Returns LayerType

uid

  • get uid(): number
  • Unique Int identifier

    Returns number

Generated using TypeDoc