TileMapPattern
Inherits: Resource < Shared < Object
Holds a pattern to be copied from or pasted into TileMapLayers.
Description
Section titled “Description”This resource holds a set of cells to help bulk manipulations of TileMapLayer.
A pattern always starts at the (0, 0) coordinates and cannot have cells with negative coordinates.
Methods
Section titled “Methods”| Returns | Method |
|---|---|
| int | get_cell_alternative_tile(coords) |
| Vector2i | get_cell_atlas_coords(coords) |
| int | get_cell_source_id(coords) |
| Vector2i | get_size() |
[]Vector2i | get_used_cells() |
| bool | has_cell(coords) |
| bool | is_empty() |
| void | remove_cell(coords, update_size) |
| void | set_cell(coords, source_id, atlas_coords, alternative_tile) |
| void | set_size(size) |
Method descriptions
Section titled “Method descriptions”get_cell_alternative_tile
Section titled “get_cell_alternative_tile”int get_cell_alternative_tile(coords: Vector2i) const
Returns the tile alternative ID of the cell at coords.
get_cell_atlas_coords
Section titled “get_cell_atlas_coords”Vector2i get_cell_atlas_coords(coords: Vector2i) const
Returns the tile atlas coordinates ID of the cell at coords.
get_cell_source_id
Section titled “get_cell_source_id”int get_cell_source_id(coords: Vector2i) const
Returns the tile source ID of the cell at coords.
get_size
Section titled “get_size”Vector2i get_size() const
Returns the size, in cells, of the pattern.
get_used_cells
Section titled “get_used_cells”[]Vector2i get_used_cells() const
Returns the list of used cell coordinates in the pattern.
has_cell
Section titled “has_cell”bool has_cell(coords: Vector2i) const
Returns whether the pattern has a tile at the given coordinates.
is_empty
Section titled “is_empty”bool is_empty() const
Returns whether the pattern is empty or not.
remove_cell
Section titled “remove_cell”void remove_cell(coords: Vector2i, update_size: bool)
Remove the cell at the given coordinates.
set_cell
Section titled “set_cell”void set_cell(coords: Vector2i, source_id: int = -1, atlas_coords: Vector2i = Vector2i(-1, -1), alternative_tile: int = -1)
Sets the tile identifiers for the cell at coordinates coords. See TileMapLayer.set_cell().
set_size
Section titled “set_size”void set_size(size: Vector2i)
Sets the size of the pattern.