MapLayer

interface MapLayer(source)

A layer of a map. A layer is a two-dimensional grid of cells which are all on the same y-level. Each cell has a location that is unique within the layer. The layer is responsible for managing the cells and providing access to them.

Properties

Link copied to clipboard
abstract val layer: Int

The layer number of this layer. The layer number is used to determine the order in which layers are drawn. It is equal to the y dimension of the map it belongs to.

Functions

Link copied to clipboard
abstract fun getCellAt(location: Location): Cell

Returns the cell at the specified location or throws an exception if there is no cell at the specified location. The y coordinate of the location is ignored.

Link copied to clipboard
abstract fun getCells(): Set<Cell>

Returns a set of all cells in this layer. There is no guarantee that the cells are ordered in any way. If you need an ordered list/grid of cells, use getCellsAsGrid.

Link copied to clipboard
abstract fun getCellsAsGrid(): List<List<Cell>>

Returns a list of all cells in this layer as a grid. The grid is a list of rows, where each row is a list of cells. The cells are ordered by their x and y coordinates.