Tile library for tilemaps.
A TileSet is a library of tiles for a [TileMap]. A TileSet handles a list of [TileSetSource], each of them storing a set of tiles.
Tiles can either be from a [TileSetAtlasSource], that render tiles out of a texture with support for physics, navigation, etc... or from a [TileSetScenesCollectionSource] which exposes scene-based tiles.
Tiles are referenced by using three IDs: their source ID, their atlas coordinates ID and their alternative tile ID.
A TileSet can be configured so that its tiles expose more or less properties. To do so, the TileSet resources uses property layers, that you can add or remove depending on your needs.
For example, adding a physics layer allows giving collision shapes to your tiles. Each layer having dedicated properties (physics layer an mask), you may add several TileSet physics layers for each type of collision you need.
See the functions to add new layers for more information.
https://docs.godotengine.org/en/latest/tutorials/2d/using_tilemaps.html
https://godotengine.org/asset-library/asset/120
https://godotengine.org/asset-library/asset/112
https://godotengine.org/asset-library/asset/111
https://godotengine.org/asset-library/asset/519
https://godotengine.org/asset-library/asset/520
https://godotengine.org/asset-library/asset/113
Adds a custom data layer to the TileSet at the given position [code]to_position[/code] in the array. If [code]to_position[/code] is -1, adds it at the end of the array.
Custom data layers allow assigning custom properties to atlas tiles.
Adds a navigation layer to the TileSet at the given position [code]to_position[/code] in the array. If [code]to_position[/code] is -1, adds it at the end of the array.
Navigation layers allow assigning a navigable area to atlas tiles.
Adds an occlusion layer to the TileSet at the given position [code]to_position[/code] in the array. If [code]to_position[/code] is -1, adds it at the end of the array.
Occlusion layers allow assigning occlusion polygons to atlas tiles.
Adds a physics layer to the TileSet at the given position [code]to_position[/code] in the array. If [code]to_position[/code] is -1, adds it at the end of the array.
Physics layers allow assigning collision polygons to atlas tiles.
Adds a [TileSetSource] to the TileSet. If [code]atlas_source_id_override[/code] is not -1, also set its source ID. Otherwise, a unique identifier is automatically generated.
The function returns the added source source ID or -1 if the source could not be added.
Adds a new terrain to the given terrain set [code]terrain_set[/code] at the given position [code]to_position[/code] in the array. If [code]to_position[/code] is -1, adds it at the end of the array.
Adds a new terrain set at the given position [code]to_position[/code] in the array. If [code]to_position[/code] is -1, adds it at the end of the array.
Clears tile proxies pointing to invalid tiles.
Clears all tile proxies.
Returns the alternative-level proxy for the given identifiers. The returned array contains the three proxie's target identifiers (source ID, atlas coords ID and alternative tile ID).
If the TileSet has no proxy for the given identifiers, returns an empty Array.
Returns the coodinate-level proxy for the given identifiers. The returned array contains the two proxie's target identifiers (source ID and atlas coords ID).
If the TileSet has no proxy for the given identifiers, returns an empty Array.
Returns the custom data layers count.
Returns the navigation layers (as in the Navigation server) of the gives TileSet navigation layer.
Returns the navigation layers count.
Returns a new unused source ID. This generated ID is the same that a call to [code]add_source[/code] would return.
Returns the light mask of the occlusion layer.
Returns if the occluders from this layer use [code]sdf_collision[/code].
Returns the occlusion layers count.
Returns the collision layer (as in the physics server) bodies on the given TileSet's physics layer are in.
Returns the collision mask of bodies on the given TileSet's physics layer.
Returns the physics material of bodies on the given TileSet's physics layer.
Returns the physics layers count.
Returns the [TileSetSource] with ID [code]source_id[/code].
Returns the number of [TileSetSource] in this TileSet.
Returns the source ID for source with index [code]index[/code].
Returns the source-level proxy for the given source identifier.
If the TileSet has no proxy for the given identifier, returns -1.
Returns a terrain's color.
Returns a terrain's name.
Returns a terrain set mode.
Returns the terrain sets count.
Returns the number of terrains in the given terrain set.
Returns if there is and alternative-level proxy for the given identifiers.
Returns if there is a coodinates-level proxy for the given identifiers.
Returns if this TileSet has a source for the given source ID.
Returns if there is a source-level proxy for the given source ID.
According to the configured proxies, maps the provided indentifiers to a new set of identifiers. The source ID, atlas coordinates ID and alternative tile ID are returned as a 3 elements Array.
This function first look for matching alternative-level proxies, then coordinates-level proxies, then source-level proxies.
If no proxy corresponding to provided identifiers are found, returns the same values the ones used as arguments.
Moves the custom data layer at index [code]layer_index[/code] to the given position [code]to_position[/code] in the array. Also updates the atlas tiles accordingly.
Moves the navigation layer at index [code]layer_index[/code] to the given position [code]to_position[/code] in the array. Also updates the atlas tiles accordingly.
Moves the occlusion layer at index [code]layer_index[/code] to the given position [code]to_position[/code] in the array. Also updates the atlas tiles accordingly.
Moves the physics layer at index [code]layer_index[/code] to the given position [code]to_position[/code] in the array. Also updates the atlas tiles accordingly.
Moves the terrain at index [code]terrain_index[/code] for terrain set [code]terrain_set[/code] to the given position [code]to_position[/code] in the array. Also updates the atlas tiles accordingly.
Moves the terrain set at index [code]terrain_set[/code] to the given position [code]to_position[/code] in the array. Also updates the atlas tiles accordingly.
Removes an alternative-level proxy for the given identifiers.
Removes a coordinates-level proxy for the given identifiers.
Removes the custom data layer at index [code]layer_index[/code]. Also updates the atlas tiles accordingly.
Removes the navigation layer at index [code]layer_index[/code]. Also updates the atlas tiles accordingly.
Removes the occlusion layer at index [code]layer_index[/code]. Also updates the atlas tiles accordingly.
Removes the physics layer at index [code]layer_index[/code]. Also updates the atlas tiles accordingly.
Removes the source with the given source ID.
Removes a source-level tile proxy.
Removes the terrain at index [code]terrain_index[/code] in the given terrain set [code]terrain_set[/code]. Also updates the atlas tiles accordingly.
Removes the terrain set at index [code]terrain_set[/code]. Also updates the atlas tiles accordingly.
Create an alternative-level proxy for the given identifiers. A proxy will map set of tile identifiers to another set of identifiers.
This can be used to replace a tile in all TileMaps using this TileSet, as TileMap nodes will find and use the proxy's target tile when one is available.
Proxied tiles can be automatically replaced in TileMap nodes using the editor.
Creates a coordinates-level proxy for the given identifiers. A proxy will map set of tile identifiers to another set of identifiers. The alternative tile ID is kept the same when using coordinates-level proxies.
This can be used to replace a tile in all TileMaps using this TileSet, as TileMap nodes will find and use the proxy's target tile when one is available.
Proxied tiles can be automatically replaced in TileMap nodes using the editor.
Sets the navigation layers (as in the navigation server) for navigation regions is the given TileSet navigation layer.
Sets the occlusion layer (as in the rendering server) for occluders in the given TileSet occlusion layer.
Enables or disables sdf collision for occluders in the given TileSet occlusion layer.
Sets the physics layer (as in the physics server) for bodies in the given TileSet physics layer.
Sets the physics layer (as in the physics server) for bodies in the given TileSet physics layer.
Sets the physics material for bodies in the given TileSet physics layer.
Changes a source's ID.
Creates a source-level proxy for the given source ID. A proxy will map set of tile identifiers to another set of identifiers. Both the atlac coordinates ID and the alternative tile ID are kept the same when using source-level proxies.
This can be used to replace a source in all TileMaps using this TileSet, as TileMap nodes will find and use the proxy's target source when one is available.
Proxied tiles can be automatically replaced in TileMap nodes using the editor.
Sets a terrain's color. This color is used for identifying the different terrains in the TileSet editor.
Sets a terrain's name.
Sets a terrain mode. Each mode determines which bits of a tile shape is used to match the neighbouring tiles' terrains.
For all half-offset shapes (Isometric, Hexagonal and Half-Offset square), changes the way tiles are indexed in the TileMap grid.
For all half-offset shapes (Isometric, Hexagonal and Half-Offset square), determines the offset axis.
The tile shape.
The tile size, in pixels. For all tile shapes, this size corresponds to the encompassing rectangle of the tile shape. This is thus the minimal cell size required in an atlas.
Enables/Disable uv clipping when rendering the tiles.
Rectangular tile shape.
Diamond tile shape (for isometric look).
Rectangular tile shape with one row/colum out of two offset by half a tile.
Hexagonal tile shape.
Tile coordinates layout where both axis stay consistent with their respective local horizontal and vertical axis.
Same as [code]TILE_LAYOUT_STAKED[/code], but the first half-offset is negative instead of positive.
Tile coordinates layout where the horizontal axis stay horizontal, and the vertical one goes down-right.
Tile coordinates layout where the vertical axis stay vertical, and the horizontal one goes down-right.
Tile coordinates layout where the horizontal axis goes up-right, and the vertical one goes down-right.
Tile coordinates layout where the horizontal axis goes down-right, and the vertical one goes down-left.
Horizontal half-offset.
Vertical half-offset.
Neighbor on the right side.
Neighbor in the right corner.
Neighbor on the bottom right side.
Neighbor in the bottom right corner.
Neighbor on the bottom side.
Neighbor in the bottom corner.
Neighbor on the bottom left side.
Neighbor in the bottom left corner.
Neighbor on the left side.
Neighbor in the left corner.
Neighbor on the top left side.
Neighbor in the top left corner.
Neighbor on the top side.
Neighbor in the top corner.
Neighbor on the top right side.
Neighbor in the top right corner.
Requires both corners and side to match with neighboring tiles' terrains.
Requires corners to match with neighboring tiles' terrains.
Requires sides to match with neighboring tiles' terrains.