Constructs a new tile layer, which can be added to a TileMap.
The asset this object is part of, or null
.
Height of the layer in tiles (only relevant for non-infinite maps).
Unique (map-wide) ID of the layer
Whether this layer is a GroupLayer.
Whether this layer is an ImageLayer.
Whether this layer is an ObjectGroup.
Whether this layer is a TileLayer.
Whether the layer is locked (affects whether child layers are locked for group layers).
Map that this layer is part of, or null
in case of a standalone layer.
Name of the layer.
Offset in pixels that is applied when this layer is rendered.
Opacity of the layer, from 0 (fully transparent) to 1 (fully opaque).
The parallax factor of this layer.
The group layer this layer is part of, or null
in case the layer is not
grouped.
Whether the object is read-only.
Whether the layer is selected.
Size of the layer in tiles (only relevant for non-infinite maps).
Tint color of the layer. Will be used to tint any images rendered by this layer or by any child layers. Affects tile layers, image layers and tile objects.
Since Tiled 1.8.5, this property is #ffffff when no tint color has been set on this layer (before it was #000000 in that case).
Whether the layer is visible (affects child layer visibility for group layers).
Width of the layer in tiles (only relevant for non-infinite maps).
Returns the value of the cell at the given position. Can be used to query the flags and the tile ID, but does not currently allow getting a tile reference (see tileAt).
Returns an object that enables making modifications to the tile layer.
Returns the flags used for the tile at the given position.
The returned number is a combination of Tile.FlippedHorizontally, Tile.FlippedVertically, Tile.FlippedAntiDiagonally and Tile.RotatedHexagonal120.
Returns all custom properties set on this object.
Modifications to the properties will not affect the original object. Does not include inherited values (see resolvedProperties).
Returns the value of the custom property with the given name, or
undefined
if no such property is set on the object. Does not
include inherited values (see resolvedProperty).
file
properties are returned as FilePath.
object
properties are returned as MapObject when possible,
or ObjectRef when the object could not be found.
Returns the region of the layer that is covered with tiles.
Removes the custom property with the given name.
Resizes the layer, erasing the part of the contents that falls outside of the layer’s new size. The offset parameter can be used to shift the contents by a certain distance in tiles before applying the resize.
Returns all custom properties set on this object. Modifications to the properties will not affect the original object. Includes values inherited from object types, templates and tiles where applicable.
Returns the value of the custom property with the given name, or
undefined
if no such property is set. Includes values inherited
from object types, templates and tiles where applicable.
Sets the value of the custom property with the given name to the given color value.
The color is specified as a string "#RGB", "#RRGGBB" or "#AARRGGBB".
Sets the value of the custom property with the given name to the given color value.
The color is specified by its red, green, blue and alpha components. Each component takes a value from 0 to 255. When not provided, the alpha defaults to 255.
Sets the value of the custom property with the given name to the given float value.
This function is provided as alternative to setProperty, since
that function will set whole numbers as int
properties.
Replaces all currently set custom properties with a new set of properties.
Sets the value of the custom property with the given name.
Supported types are bool
, number
, string
, color,
FilePath, ObjectRef, MapObject and
PropertyValue.
Sets the value of an object's property identified by the given path to the given value.
The path is a list of property names, where each name identifies a member of the previous member's value. The last name in the list identifies the property to set.
Supported types are bool
, number
, string
, color,
FilePath, ObjectRef, MapObject and
PropertyValue.
Returns the tile used at the given position, or null for empty spaces.
Returns an object that enables making modifications to the tile layer using the given WangSet.
Generated using TypeDoc
A tile layer.
Note that while tile layers have a size, the size is generally ignored on infinite maps. Even for fixed size maps, nothing in the scripting API stops you from changing the layer outside of its boundaries and changing the size of the layer has no effect on its contents. If you want to change the size while affecting the contents, use the resize function.