Base class for map layers
init agruments, which become attributes:
- map¶
The map this layer belongs to. Unlike tilesets, layers are tied to a particular map and cannot be shared.
- name¶
Name of the layer
- visible¶
A boolean setting whether the layer is visible at all. (Actual visibility also depends on opacity)
- opacity¶
Floating-point value for the visibility of the layer. (Actual visibility also depends on visible)
Other attributes:
A Layer is false in a boolean context iff it is empty, that is, if all tiles of a tile layer are false, or if an object layer contains no objects.
Methods:
Dict import/export:
A tile layer
Acts as a 2D array of MapTile’s, indexed by [x, y] coordinates. Assignment is possible either via numeric values, or by assigning a TilesetTile. In the latter case, if the tileset is not on the map yet, it is added.
See Layer documentation for most init arguments.
Other init agruments, which become attributes:
- data¶
Optional list (or array) containing the values of tiles in the layer, as one long list in row-major order. See TileLikeObject.value for what the numbers will mean.
Methods:
Tile access:
Methods to be overridden in subclasses:
Dict import/export:
A layer of objects.
Acts as a named list of objects. This means semantics similar to layer/tileset lists: indexing by name is possible, where a name references the first object of such name.
See Layer for inherited init arguments.
ObjectLayer-specific init arguments, which become attributes:
- color¶
The intended color of objects in this layer, as a triple of floats (0..1)
Methods:
Dict import/export:
A list of layers.
Allows indexing by name, and can only contain layers of a single map.
See NamedElementList for LayerList’s methods.