Also added layered tilemap docs.

This commit is contained in:
Relintai 2024-03-01 10:43:35 +01:00
parent caa9099915
commit fb8ea11c03
8 changed files with 2050 additions and 0 deletions

View File

@ -0,0 +1,249 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TileData" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Settings for a single tile in a [TileSet].
</brief_description>
<description>
[TileData] object represents a single tile in a [TileSet]. It is usually edited using the tileset editor, but it can be modified at runtime using [method TileMap._tile_data_runtime_update].
</description>
<tutorials>
</tutorials>
<methods>
<method name="add_collision_polygon">
<return type="void" />
<param index="0" name="layer_id" type="int" />
<description>
Adds a collision polygon to the tile on the given TileSet physics layer.
</description>
</method>
<method name="get_collision_polygon_one_way_margin" qualifiers="const">
<return type="float" />
<param index="0" name="layer_id" type="int" />
<param index="1" name="polygon_index" type="int" />
<description>
Returns the one-way margin (for one-way platforms) of the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id].
</description>
</method>
<method name="get_collision_polygon_points" qualifiers="const">
<return type="PackedVector2Array" />
<param index="0" name="layer_id" type="int" />
<param index="1" name="polygon_index" type="int" />
<description>
Returns the points of the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id].
</description>
</method>
<method name="get_collision_polygons_count" qualifiers="const">
<return type="int" />
<param index="0" name="layer_id" type="int" />
<description>
Returns how many polygons the tile has for TileSet physics layer with index [param layer_id].
</description>
</method>
<method name="get_constant_angular_velocity" qualifiers="const">
<return type="float" />
<param index="0" name="layer_id" type="int" />
<description>
Returns the constant angular velocity applied to objects colliding with this tile.
</description>
</method>
<method name="get_constant_linear_velocity" qualifiers="const">
<return type="Vector2" />
<param index="0" name="layer_id" type="int" />
<description>
Returns the constant linear velocity applied to objects colliding with this tile.
</description>
</method>
<method name="get_custom_data" qualifiers="const">
<return type="Variant" />
<param index="0" name="layer_name" type="String" />
<description>
Returns the custom data value for custom data layer named [param layer_name].
</description>
</method>
<method name="get_custom_data_by_layer_id" qualifiers="const">
<return type="Variant" />
<param index="0" name="layer_id" type="int" />
<description>
Returns the custom data value for custom data layer with index [param layer_id].
</description>
</method>
<method name="get_navigation_polygon" qualifiers="const">
<return type="NavigationPolygon" />
<param index="0" name="layer_id" type="int" />
<param index="1" name="flip_h" type="bool" default="false" />
<param index="2" name="flip_v" type="bool" default="false" />
<param index="3" name="transpose" type="bool" default="false" />
<description>
Returns the navigation polygon of the tile for the TileSet navigation layer with index [param layer_id].
[param flip_h], [param flip_v], and [param transpose] allow transforming the returned polygon.
</description>
</method>
<method name="get_occluder" qualifiers="const">
<return type="OccluderPolygon2D" />
<param index="0" name="layer_id" type="int" />
<param index="1" name="flip_h" type="bool" default="false" />
<param index="2" name="flip_v" type="bool" default="false" />
<param index="3" name="transpose" type="bool" default="false" />
<description>
Returns the occluder polygon of the tile for the TileSet occlusion layer with index [param layer_id].
[param flip_h], [param flip_v], and [param transpose] allow transforming the returned polygon.
</description>
</method>
<method name="get_terrain_peering_bit" qualifiers="const">
<return type="int" />
<param index="0" name="peering_bit" type="int" enum="TileSet.CellNeighbor" />
<description>
Returns the tile's terrain bit for the given [param peering_bit] direction.
</description>
</method>
<method name="is_collision_polygon_one_way" qualifiers="const">
<return type="bool" />
<param index="0" name="layer_id" type="int" />
<param index="1" name="polygon_index" type="int" />
<description>
Returns whether one-way collisions are enabled for the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id].
</description>
</method>
<method name="remove_collision_polygon">
<return type="void" />
<param index="0" name="layer_id" type="int" />
<param index="1" name="polygon_index" type="int" />
<description>
Removes the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id].
</description>
</method>
<method name="set_collision_polygon_one_way">
<return type="void" />
<param index="0" name="layer_id" type="int" />
<param index="1" name="polygon_index" type="int" />
<param index="2" name="one_way" type="bool" />
<description>
Enables/disables one-way collisions on the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id].
</description>
</method>
<method name="set_collision_polygon_one_way_margin">
<return type="void" />
<param index="0" name="layer_id" type="int" />
<param index="1" name="polygon_index" type="int" />
<param index="2" name="one_way_margin" type="float" />
<description>
Enables/disables one-way collisions on the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id].
</description>
</method>
<method name="set_collision_polygon_points">
<return type="void" />
<param index="0" name="layer_id" type="int" />
<param index="1" name="polygon_index" type="int" />
<param index="2" name="polygon" type="PackedVector2Array" />
<description>
Sets the points of the polygon at index [param polygon_index] for TileSet physics layer with index [param layer_id].
</description>
</method>
<method name="set_collision_polygons_count">
<return type="void" />
<param index="0" name="layer_id" type="int" />
<param index="1" name="polygons_count" type="int" />
<description>
Sets the polygons count for TileSet physics layer with index [param layer_id].
</description>
</method>
<method name="set_constant_angular_velocity">
<return type="void" />
<param index="0" name="layer_id" type="int" />
<param index="1" name="velocity" type="float" />
<description>
Sets the constant angular velocity. This does not rotate the tile. This angular velocity is applied to objects colliding with this tile.
</description>
</method>
<method name="set_constant_linear_velocity">
<return type="void" />
<param index="0" name="layer_id" type="int" />
<param index="1" name="velocity" type="Vector2" />
<description>
Sets the constant linear velocity. This does not move the tile. This linear velocity is applied to objects colliding with this tile. This is useful to create conveyor belts.
</description>
</method>
<method name="set_custom_data">
<return type="void" />
<param index="0" name="layer_name" type="String" />
<param index="1" name="value" type="Variant" />
<description>
Sets the tile's custom data value for the TileSet custom data layer with name [param layer_name].
</description>
</method>
<method name="set_custom_data_by_layer_id">
<return type="void" />
<param index="0" name="layer_id" type="int" />
<param index="1" name="value" type="Variant" />
<description>
Sets the tile's custom data value for the TileSet custom data layer with index [param layer_id].
</description>
</method>
<method name="set_navigation_polygon">
<return type="void" />
<param index="0" name="layer_id" type="int" />
<param index="1" name="navigation_polygon" type="NavigationPolygon" />
<description>
Sets the navigation polygon for the TileSet navigation layer with index [param layer_id].
</description>
</method>
<method name="set_occluder">
<return type="void" />
<param index="0" name="layer_id" type="int" />
<param index="1" name="occluder_polygon" type="OccluderPolygon2D" />
<description>
Sets the occluder for the TileSet occlusion layer with index [param layer_id].
</description>
</method>
<method name="set_terrain_peering_bit">
<return type="void" />
<param index="0" name="peering_bit" type="int" enum="TileSet.CellNeighbor" />
<param index="1" name="terrain" type="int" />
<description>
Sets the tile's terrain bit for the given [param peering_bit] direction.
</description>
</method>
</methods>
<members>
<member name="flip_h" type="bool" setter="set_flip_h" getter="get_flip_h" default="false">
If [code]true[/code], the tile will have its texture flipped horizontally.
</member>
<member name="flip_v" type="bool" setter="set_flip_v" getter="get_flip_v" default="false">
If [code]true[/code], the tile will have its texture flipped vertically.
</member>
<member name="material" type="Material" setter="set_material" getter="get_material">
The [Material] to use for this [TileData]. This can be a [CanvasItemMaterial] to use the default shader, or a [ShaderMaterial] to use a custom shader.
</member>
<member name="modulate" type="Color" setter="set_modulate" getter="get_modulate" default="Color(1, 1, 1, 1)" keywords="color, colour">
Color modulation of the tile.
</member>
<member name="probability" type="float" setter="set_probability" getter="get_probability" default="1.0">
Relative probability of this tile being selected when drawing a pattern of random tiles.
</member>
<member name="terrain" type="int" setter="set_terrain" getter="get_terrain" default="-1">
ID of the terrain from the terrain set that the tile uses.
</member>
<member name="terrain_set" type="int" setter="set_terrain_set" getter="get_terrain_set" default="-1">
ID of the terrain set that the tile uses.
</member>
<member name="texture_origin" type="Vector2i" setter="set_texture_origin" getter="get_texture_origin" default="Vector2i(0, 0)">
Offsets the position of where the tile is drawn.
</member>
<member name="transpose" type="bool" setter="set_transpose" getter="get_transpose" default="false">
If [code]true[/code], the tile will display transposed, i.e. with horizontal and vertical texture UVs swapped.
</member>
<member name="y_sort_origin" type="int" setter="set_y_sort_origin" getter="get_y_sort_origin" default="0">
Vertical point of the tile used for determining y-sorted order.
</member>
<member name="z_index" type="int" setter="set_z_index" getter="get_z_index" default="0">
Ordering index of this tile, relative to [TileMap].
</member>
</members>
<signals>
<signal name="changed">
<description>
Emitted when any of the properties are changed.
</description>
</signal>
</signals>
</class>

View File

@ -0,0 +1,510 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TileMap" inherits="TileMapLayerGroup" keywords="gridmap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Node for 2D tile-based maps.
</brief_description>
<description>
Node for 2D tile-based maps. Tilemaps use a [TileSet] which contain a list of tiles which are used to create grid-based maps. A TileMap may have several layers, layouting tiles on top of each other.
For performance reasons, all TileMap updates are batched at the end of a frame. Notably, this means that scene tiles from a [TileSetScenesCollectionSource] may be initialized after their parent. This is only queued when inside the scene tree.
To force an update earlier on, call [method update_internals].
</description>
<tutorials>
<link title="Using Tilemaps">$DOCS_URL/tutorials/2d/using_tilemaps.html</link>
<link title="2D Platformer Demo">https://godotengine.org/asset-library/asset/120</link>
<link title="2D Isometric Demo">https://godotengine.org/asset-library/asset/112</link>
<link title="2D Hexagonal Demo">https://godotengine.org/asset-library/asset/111</link>
<link title="2D Navigation Astar Demo">https://godotengine.org/asset-library/asset/519</link>
<link title="2D Role Playing Game Demo">https://godotengine.org/asset-library/asset/520</link>
<link title="2D Kinematic Character Demo">https://godotengine.org/asset-library/asset/113</link>
</tutorials>
<methods>
<method name="_tile_data_runtime_update" qualifiers="virtual">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="coords" type="Vector2i" />
<param index="2" name="tile_data" type="TileData" />
<description>
Called with a TileData object about to be used internally by the TileMap, allowing its modification at runtime.
This method is only called if [method _use_tile_data_runtime_update] is implemented and returns [code]true[/code] for the given tile [param coords] and [param layer].
[b]Warning:[/b] The [param tile_data] object's sub-resources are the same as the one in the TileSet. Modifying them might impact the whole TileSet. Instead, make sure to duplicate those resources.
[b]Note:[/b] If the properties of [param tile_data] object should change over time, use [method notify_runtime_tile_data_update] to notify the TileMap it needs an update.
</description>
</method>
<method name="_use_tile_data_runtime_update" qualifiers="virtual">
<return type="bool" />
<param index="0" name="layer" type="int" />
<param index="1" name="coords" type="Vector2i" />
<description>
Should return [code]true[/code] if the tile at coordinates [param coords] on layer [param layer] requires a runtime update.
[b]Warning:[/b] Make sure this function only return [code]true[/code] when needed. Any tile processed at runtime without a need for it will imply a significant performance penalty.
[b]Note:[/b] If the result of this function should changed, use [method notify_runtime_tile_data_update] to notify the TileMap it needs an update.
</description>
</method>
<method name="add_layer">
<return type="void" />
<param index="0" name="to_position" type="int" />
<description>
Adds a layer at the given position [param to_position] in the array. If [param to_position] is negative, the position is counted from the end, with [code]-1[/code] adding the layer at the end of the array.
</description>
</method>
<method name="clear">
<return type="void" />
<description>
Clears all cells.
</description>
</method>
<method name="clear_layer">
<return type="void" />
<param index="0" name="layer" type="int" />
<description>
Clears all cells on the given layer.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="erase_cell">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="coords" type="Vector2i" />
<description>
Erases the cell on layer [param layer] at coordinates [param coords].
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="fix_invalid_tiles">
<return type="void" />
<description>
Clears cells that do not exist in the tileset.
</description>
</method>
<method name="force_update" deprecated="Use [method notify_runtime_tile_data_update] and/or [method update_internals] instead.">
<return type="void" />
<param index="0" name="layer" type="int" default="-1" />
<description>
Forces the TileMap and the layer [param layer] to update.
</description>
</method>
<method name="get_cell_alternative_tile" qualifiers="const">
<return type="int" />
<param index="0" name="layer" type="int" />
<param index="1" name="coords" type="Vector2i" />
<param index="2" name="use_proxies" type="bool" default="false" />
<description>
Returns the tile alternative ID of the cell on layer [param layer] at [param coords]. If [param use_proxies] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy].
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="get_cell_atlas_coords" qualifiers="const">
<return type="Vector2i" />
<param index="0" name="layer" type="int" />
<param index="1" name="coords" type="Vector2i" />
<param index="2" name="use_proxies" type="bool" default="false" />
<description>
Returns the tile atlas coordinates ID of the cell on layer [param layer] at coordinates [param coords]. If [param use_proxies] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy].
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="get_cell_source_id" qualifiers="const">
<return type="int" />
<param index="0" name="layer" type="int" />
<param index="1" name="coords" type="Vector2i" />
<param index="2" name="use_proxies" type="bool" default="false" />
<description>
Returns the tile source ID of the cell on layer [param layer] at coordinates [param coords]. Returns [code]-1[/code] if the cell does not exist.
If [param use_proxies] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy].
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="get_cell_tile_data" qualifiers="const">
<return type="TileData" />
<param index="0" name="layer" type="int" />
<param index="1" name="coords" type="Vector2i" />
<param index="2" name="use_proxies" type="bool" default="false" />
<description>
Returns the [TileData] object associated with the given cell, or [code]null[/code] if the cell does not exist or is not a [TileSetAtlasSource].
If [param layer] is negative, the layers are accessed from the last one.
If [param use_proxies] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy].
[codeblock]
func get_clicked_tile_power():
var clicked_cell = tile_map.local_to_map(tile_map.get_local_mouse_position())
var data = tile_map.get_cell_tile_data(0, clicked_cell)
if data:
return data.get_custom_data("power")
else:
return 0
[/codeblock]
</description>
</method>
<method name="get_coords_for_body_rid">
<return type="Vector2i" />
<param index="0" name="body" type="RID" />
<description>
Returns the coordinates of the tile for given physics body RID. Such RID can be retrieved from [method KinematicCollision2D.get_collider_rid], when colliding with a tile.
</description>
</method>
<method name="get_layer_for_body_rid">
<return type="int" />
<param index="0" name="body" type="RID" />
<description>
Returns the tilemap layer of the tile for given physics body RID. Such RID can be retrieved from [method KinematicCollision2D.get_collider_rid], when colliding with a tile.
</description>
</method>
<method name="get_layer_modulate" qualifiers="const">
<return type="Color" />
<param index="0" name="layer" type="int" />
<description>
Returns a TileMap layer's modulate.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="get_layer_name" qualifiers="const">
<return type="String" />
<param index="0" name="layer" type="int" />
<description>
Returns a TileMap layer's name.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="get_layer_navigation_map" qualifiers="const">
<return type="RID" />
<param index="0" name="layer" type="int" />
<description>
Returns the [RID] of the [NavigationServer2D] navigation map assigned to the specified TileMap layer [param layer].
By default the TileMap uses the default [World2D] navigation map for the first TileMap layer. For each additional TileMap layer a new navigation map is created for the additional layer.
In order to make [NavigationAgent2D] switch between TileMap layer navigation maps use [method NavigationAgent2D.set_navigation_map] with the navigation map received from [method get_layer_navigation_map].
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="get_layer_y_sort_origin" qualifiers="const">
<return type="int" />
<param index="0" name="layer" type="int" />
<description>
Returns a TileMap layer's Y sort origin.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="get_layer_z_index" qualifiers="const">
<return type="int" />
<param index="0" name="layer" type="int" />
<description>
Returns a TileMap layer's Z-index value.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="get_layers_count" qualifiers="const">
<return type="int" />
<description>
Returns the number of layers in the TileMap.
</description>
</method>
<method name="get_navigation_map" qualifiers="const" deprecated="Use [method get_layer_navigation_map] instead.">
<return type="RID" />
<param index="0" name="layer" type="int" />
<description>
Returns the [RID] of the [NavigationServer2D] navigation map assigned to the specified TileMap layer [param layer].
</description>
</method>
<method name="get_neighbor_cell" qualifiers="const">
<return type="Vector2i" />
<param index="0" name="coords" type="Vector2i" />
<param index="1" name="neighbor" type="int" enum="TileSet.CellNeighbor" />
<description>
Returns the neighboring cell to the one at coordinates [param coords], identified by the [param neighbor] direction. This method takes into account the different layouts a TileMap can take.
</description>
</method>
<method name="get_pattern">
<return type="TileMapPattern" />
<param index="0" name="layer" type="int" />
<param index="1" name="coords_array" type="Vector2i[]" />
<description>
Creates a new [TileMapPattern] from the given layer and set of cells.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="get_surrounding_cells">
<return type="Vector2i[]" />
<param index="0" name="coords" type="Vector2i" />
<description>
Returns the list of all neighbourings cells to the one at [param coords].
</description>
</method>
<method name="get_used_cells" qualifiers="const">
<return type="Vector2i[]" />
<param index="0" name="layer" type="int" />
<description>
Returns a [Vector2i] array with the positions of all cells containing a tile in the given layer. A cell is considered empty if its source identifier equals -1, its atlas coordinates identifiers is [code]Vector2(-1, -1)[/code] and its alternative identifier is -1.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="get_used_cells_by_id" qualifiers="const">
<return type="Vector2i[]" />
<param index="0" name="layer" type="int" />
<param index="1" name="source_id" type="int" default="-1" />
<param index="2" name="atlas_coords" type="Vector2i" default="Vector2i(-1, -1)" />
<param index="3" name="alternative_tile" type="int" default="-1" />
<description>
Returns a [Vector2i] array with the positions of all cells containing a tile in the given layer. Tiles may be filtered according to their source ([param source_id]), their atlas coordinates ([param atlas_coords]) or alternative id ([param alternative_tile]).
If a parameter has its value set to the default one, this parameter is not used to filter a cell. Thus, if all parameters have their respective default value, this method returns the same result as [method get_used_cells].
A cell is considered empty if its source identifier equals -1, its atlas coordinates identifiers is [code]Vector2(-1, -1)[/code] and its alternative identifier is -1.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="get_used_rect" qualifiers="const">
<return type="Rect2i" />
<description>
Returns a rectangle enclosing the used (non-empty) tiles of the map, including all layers.
</description>
</method>
<method name="is_layer_enabled" qualifiers="const">
<return type="bool" />
<param index="0" name="layer" type="int" />
<description>
Returns if a layer is enabled.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="is_layer_navigation_enabled" qualifiers="const">
<return type="bool" />
<param index="0" name="layer" type="int" />
<description>
Returns if a layer's built-in navigation regions generation is enabled.
</description>
</method>
<method name="is_layer_y_sort_enabled" qualifiers="const">
<return type="bool" />
<param index="0" name="layer" type="int" />
<description>
Returns if a layer Y-sorts its tiles.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="local_to_map" qualifiers="const">
<return type="Vector2i" />
<param index="0" name="local_position" type="Vector2" />
<description>
Returns the map coordinates of the cell containing the given [param local_position]. If [param local_position] is in global coordinates, consider using [method Node2D.to_local] before passing it to this method. See also [method map_to_local].
</description>
</method>
<method name="map_pattern">
<return type="Vector2i" />
<param index="0" name="position_in_tilemap" type="Vector2i" />
<param index="1" name="coords_in_pattern" type="Vector2i" />
<param index="2" name="pattern" type="TileMapPattern" />
<description>
Returns for the given coordinate [param coords_in_pattern] in a [TileMapPattern] the corresponding cell coordinates if the pattern was pasted at the [param position_in_tilemap] coordinates (see [method set_pattern]). This mapping is required as in half-offset tile shapes, the mapping might not work by calculating [code]position_in_tile_map + coords_in_pattern[/code].
</description>
</method>
<method name="map_to_local" qualifiers="const">
<return type="Vector2" />
<param index="0" name="map_position" type="Vector2i" />
<description>
Returns the centered position of a cell in the TileMap's local coordinate space. To convert the returned value into global coordinates, use [method Node2D.to_global]. See also [method local_to_map].
[b]Note:[/b] This may not correspond to the visual position of the tile, i.e. it ignores the [member TileData.texture_origin] property of individual tiles.
</description>
</method>
<method name="move_layer">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="to_position" type="int" />
<description>
Moves the layer at index [param layer] to the given position [param to_position] in the array.
</description>
</method>
<method name="notify_runtime_tile_data_update">
<return type="void" />
<param index="0" name="layer" type="int" default="-1" />
<description>
Notifies the TileMap node that calls to [method _use_tile_data_runtime_update] or [method _tile_data_runtime_update] will lead to different results. This will thus trigger a TileMap update.
If [param layer] is provided, only notifies changes for the given layer. Providing the [param layer] argument (when applicable) is usually preferred for performance reasons.
[b]Warning:[/b] Updating the TileMap is computationally expensive and may impact performance. Try to limit the number of calls to this function to avoid unnecessary update.
[b]Note:[/b] This does not trigger a direct update of the TileMap, the update will be done at the end of the frame as usual (unless you call [method update_internals]).
</description>
</method>
<method name="remove_layer">
<return type="void" />
<param index="0" name="layer" type="int" />
<description>
Removes the layer at index [param layer].
</description>
</method>
<method name="set_cell">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="coords" type="Vector2i" />
<param index="2" name="source_id" type="int" default="-1" />
<param index="3" name="atlas_coords" type="Vector2i" default="Vector2i(-1, -1)" />
<param index="4" name="alternative_tile" type="int" default="0" />
<description>
Sets the tile identifiers for the cell on layer [param layer] at coordinates [param coords]. Each tile of the [TileSet] is identified using three parts:
- The source identifier [param source_id] identifies a [TileSetSource] identifier. See [method TileSet.set_source_id],
- The atlas coordinates identifier [param atlas_coords] identifies a tile coordinates in the atlas (if the source is a [TileSetAtlasSource]). For [TileSetScenesCollectionSource] it should always be [code]Vector2i(0, 0)[/code]),
- The alternative tile identifier [param alternative_tile] identifies a tile alternative in the atlas (if the source is a [TileSetAtlasSource]), and the scene for a [TileSetScenesCollectionSource].
If [param source_id] is set to [code]-1[/code], [param atlas_coords] to [code]Vector2i(-1, -1)[/code] or [param alternative_tile] to [code]-1[/code], the cell will be erased. An erased cell gets [b]all[/b] its identifiers automatically set to their respective invalid values, namely [code]-1[/code], [code]Vector2i(-1, -1)[/code] and [code]-1[/code].
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="set_cells_terrain_connect">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="cells" type="Vector2i[]" />
<param index="2" name="terrain_set" type="int" />
<param index="3" name="terrain" type="int" />
<param index="4" name="ignore_empty_terrains" type="bool" default="true" />
<description>
Update all the cells in the [param cells] coordinates array so that they use the given [param terrain] for the given [param terrain_set]. If an updated cell has the same terrain as one of its neighboring cells, this function tries to join the two. This function might update neighboring tiles if needed to create correct terrain transitions.
If [param ignore_empty_terrains] is true, empty terrains will be ignored when trying to find the best fitting tile for the given terrain constraints.
If [param layer] is negative, the layers are accessed from the last one.
[b]Note:[/b] To work correctly, this method requires the TileMap's TileSet to have terrains set up with all required terrain combinations. Otherwise, it may produce unexpected results.
</description>
</method>
<method name="set_cells_terrain_path">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="path" type="Vector2i[]" />
<param index="2" name="terrain_set" type="int" />
<param index="3" name="terrain" type="int" />
<param index="4" name="ignore_empty_terrains" type="bool" default="true" />
<description>
Update all the cells in the [param path] coordinates array so that they use the given [param terrain] for the given [param terrain_set]. The function will also connect two successive cell in the path with the same terrain. This function might update neighboring tiles if needed to create correct terrain transitions.
If [param ignore_empty_terrains] is true, empty terrains will be ignored when trying to find the best fitting tile for the given terrain constraints.
If [param layer] is negative, the layers are accessed from the last one.
[b]Note:[/b] To work correctly, this method requires the TileMap's TileSet to have terrains set up with all required terrain combinations. Otherwise, it may produce unexpected results.
</description>
</method>
<method name="set_layer_enabled">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="enabled" type="bool" />
<description>
Enables or disables the layer [param layer]. A disabled layer is not processed at all (no rendering, no physics, etc...).
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="set_layer_modulate">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="modulate" type="Color" />
<description>
Sets a layer's color. It will be multiplied by tile's color and TileMap's modulate.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="set_layer_name">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="name" type="String" />
<description>
Sets a layer's name. This is mostly useful in the editor.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="set_layer_navigation_enabled">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="enabled" type="bool" />
<description>
Enables or disables a layer's built-in navigation regions generation. Disable this if you need to bake navigation regions from a TileMap using a [NavigationRegion2D] node.
</description>
</method>
<method name="set_layer_navigation_map">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="map" type="RID" />
<description>
Assigns [param map] as a [NavigationServer2D] navigation map for the specified TileMap layer [param layer].
By default the TileMap uses the default [World2D] navigation map for the first TileMap layer. For each additional TileMap layer a new navigation map is created for the additional layer.
In order to make [NavigationAgent2D] switch between TileMap layer navigation maps use [method NavigationAgent2D.set_navigation_map] with the navigation map received from [method get_layer_navigation_map].
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="set_layer_y_sort_enabled">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="y_sort_enabled" type="bool" />
<description>
Enables or disables a layer's Y-sorting. If a layer is Y-sorted, the layer will behave as a CanvasItem node where each of its tile gets Y-sorted.
Y-sorted layers should usually be on different Z-index values than not Y-sorted layers, otherwise, each of those layer will be Y-sorted as whole with the Y-sorted one. This is usually an undesired behavior.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="set_layer_y_sort_origin">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="y_sort_origin" type="int" />
<description>
Sets a layer's Y-sort origin value. This Y-sort origin value is added to each tile's Y-sort origin value.
This allows, for example, to fake a different height level on each layer. This can be useful for top-down view games.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="set_layer_z_index">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="z_index" type="int" />
<description>
Sets a layers Z-index value. This Z-index is added to each tile's Z-index value.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="set_navigation_map" deprecated="Use [method set_layer_navigation_map] instead.">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="map" type="RID" />
<description>
Assigns [param map] as a [NavigationServer2D] navigation map for the specified TileMap layer [param layer].
</description>
</method>
<method name="set_pattern">
<return type="void" />
<param index="0" name="layer" type="int" />
<param index="1" name="position" type="Vector2i" />
<param index="2" name="pattern" type="TileMapPattern" />
<description>
Paste the given [TileMapPattern] at the given [param position] and [param layer] in the tile map.
If [param layer] is negative, the layers are accessed from the last one.
</description>
</method>
<method name="update_internals">
<return type="void" />
<description>
Triggers a direct update of the TileMap. Usually, calling this function is not needed, as TileMap node updates automatically when one of its properties or cells is modified.
However, for performance reasons, those updates are batched and delayed to the end of the frame. Calling this function will force the TileMap to update right away instead.
[b]Warning:[/b] Updating the TileMap is computationally expensive and may impact performance. Try to limit the number of updates and how many tiles they impact.
</description>
</method>
</methods>
<members>
<member name="collision_animatable" type="bool" setter="set_collision_animatable" getter="is_collision_animatable" default="false">
If enabled, the TileMap will see its collisions synced to the physics tick and change its collision type from static to kinematic. This is required to create TileMap-based moving platform.
[b]Note:[/b] Enabling [member collision_animatable] may have a small performance impact, only do it if the TileMap is moving and has colliding tiles.
</member>
<member name="collision_visibility_mode" type="int" setter="set_collision_visibility_mode" getter="get_collision_visibility_mode" enum="TileMap.VisibilityMode" default="0">
Show or hide the TileMap's collision shapes. If set to [constant VISIBILITY_MODE_DEFAULT], this depends on the show collision debug settings.
</member>
<member name="navigation_visibility_mode" type="int" setter="set_navigation_visibility_mode" getter="get_navigation_visibility_mode" enum="TileMap.VisibilityMode" default="0">
Show or hide the TileMap's navigation meshes. If set to [constant VISIBILITY_MODE_DEFAULT], this depends on the show navigation debug settings.
</member>
<member name="rendering_quadrant_size" type="int" setter="set_rendering_quadrant_size" getter="get_rendering_quadrant_size" default="16">
The TileMap's quadrant size. A quadrant is a group of tiles to be drawn together on a single canvas item, for optimization purposes. [member rendering_quadrant_size] defines the length of a square's side, in the map's coordinate system, that forms the quadrant. Thus, the default quandrant size groups together [code]16 * 16 = 256[/code] tiles.
The quadrant size does not apply on Y-sorted layers, as tiles are be grouped by Y position instead in that case.
[b]Note:[/b] As quadrants are created according to the map's coordinate system, the quadrant's "square shape" might not look like square in the TileMap's local coordinate system.
</member>
</members>
<signals>
<signal name="changed">
<description>
Emitted when the [TileSet] of this TileMap changes.
</description>
</signal>
</signals>
<constants>
<constant name="VISIBILITY_MODE_DEFAULT" value="0" enum="VisibilityMode">
Use the debug settings to determine visibility.
</constant>
<constant name="VISIBILITY_MODE_FORCE_HIDE" value="2" enum="VisibilityMode">
Always hide.
</constant>
<constant name="VISIBILITY_MODE_FORCE_SHOW" value="1" enum="VisibilityMode">
Always show.
</constant>
</constants>
</class>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TileMapLayerGroup" inherits="Node2D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Groups a set of tile map layers together, allowing them to share a provided [TileSet].
</brief_description>
<description>
Groups together tile map layers as part or the same map, replacing the [TileMap] node. Child layers will use this node's [member tile_set].
The editor also uses [TileMapLayerGroup] as a way to store which layers are selected in a given group. This allows highlighting the currently selected layers.
</description>
<tutorials>
</tutorials>
<members>
<member name="tile_set" type="TileSet" setter="set_tileset" getter="get_tileset">
The assigned [TileSet]. This TileSet will be applied to all child layers.
</member>
</members>
</class>

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TileMapPattern" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Holds a pattern to be copied from or pasted into [TileMap]s.
</brief_description>
<description>
This resource holds a set of cells to help bulk manipulations of [TileMap].
A pattern always start at the [code](0,0)[/code] coordinates and cannot have cells with negative coordinates.
</description>
<tutorials>
</tutorials>
<methods>
<method name="get_cell_alternative_tile" qualifiers="const">
<return type="int" />
<param index="0" name="coords" type="Vector2i" />
<description>
Returns the tile alternative ID of the cell at [param coords].
</description>
</method>
<method name="get_cell_atlas_coords" qualifiers="const">
<return type="Vector2i" />
<param index="0" name="coords" type="Vector2i" />
<description>
Returns the tile atlas coordinates ID of the cell at [param coords].
</description>
</method>
<method name="get_cell_source_id" qualifiers="const">
<return type="int" />
<param index="0" name="coords" type="Vector2i" />
<description>
Returns the tile source ID of the cell at [param coords].
</description>
</method>
<method name="get_size" qualifiers="const">
<return type="Vector2i" />
<description>
Returns the size, in cells, of the pattern.
</description>
</method>
<method name="get_used_cells" qualifiers="const">
<return type="Vector2i[]" />
<description>
Returns the list of used cell coordinates in the pattern.
</description>
</method>
<method name="has_cell" qualifiers="const">
<return type="bool" />
<param index="0" name="coords" type="Vector2i" />
<description>
Returns whether the pattern has a tile at the given coordinates.
</description>
</method>
<method name="is_empty" qualifiers="const">
<return type="bool" />
<description>
Returns whether the pattern is empty or not.
</description>
</method>
<method name="remove_cell">
<return type="void" />
<param index="0" name="coords" type="Vector2i" />
<param index="1" name="update_size" type="bool" />
<description>
Remove the cell at the given coordinates.
</description>
</method>
<method name="set_cell">
<return type="void" />
<param index="0" name="coords" type="Vector2i" />
<param index="1" name="source_id" type="int" default="-1" />
<param index="2" name="atlas_coords" type="Vector2i" default="Vector2i(-1, -1)" />
<param index="3" name="alternative_tile" type="int" default="-1" />
<description>
Sets the tile identifiers for the cell at coordinates [param coords]. See [method TileMap.set_cell].
</description>
</method>
<method name="set_size">
<return type="void" />
<param index="0" name="size" type="Vector2i" />
<description>
Sets the size of the pattern.
</description>
</method>
</methods>
</class>

View File

@ -0,0 +1,727 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TileSet" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Tile library for tilemaps.
</brief_description>
<description>
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], which renders 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 fewer properties. To do so, the TileSet resources use property layers, which you can add or remove depending on your needs.
For example, adding a physics layer allows giving collision shapes to your tiles. Each layer has dedicated properties (physics layer and mask), so you may add several TileSet physics layers for each type of collision you need.
See the functions to add new layers for more information.
</description>
<tutorials>
<link title="Using Tilemaps">$DOCS_URL/tutorials/2d/using_tilemaps.html</link>
<link title="2D Platformer Demo">https://godotengine.org/asset-library/asset/120</link>
<link title="2D Isometric Demo">https://godotengine.org/asset-library/asset/112</link>
<link title="2D Hexagonal Demo">https://godotengine.org/asset-library/asset/111</link>
<link title="2D Navigation Astar Demo">https://godotengine.org/asset-library/asset/519</link>
<link title="2D Role Playing Game Demo">https://godotengine.org/asset-library/asset/520</link>
<link title="2D Kinematic Character Demo">https://godotengine.org/asset-library/asset/113</link>
</tutorials>
<methods>
<method name="add_custom_data_layer">
<return type="void" />
<param index="0" name="to_position" type="int" default="-1" />
<description>
Adds a custom data layer to the TileSet at the given position [param to_position] in the array. If [param to_position] is -1, adds it at the end of the array.
Custom data layers allow assigning custom properties to atlas tiles.
</description>
</method>
<method name="add_navigation_layer">
<return type="void" />
<param index="0" name="to_position" type="int" default="-1" />
<description>
Adds a navigation layer to the TileSet at the given position [param to_position] in the array. If [param to_position] is -1, adds it at the end of the array.
Navigation layers allow assigning a navigable area to atlas tiles.
</description>
</method>
<method name="add_occlusion_layer">
<return type="void" />
<param index="0" name="to_position" type="int" default="-1" />
<description>
Adds an occlusion layer to the TileSet at the given position [param to_position] in the array. If [param to_position] is -1, adds it at the end of the array.
Occlusion layers allow assigning occlusion polygons to atlas tiles.
</description>
</method>
<method name="add_pattern">
<return type="int" />
<param index="0" name="pattern" type="TileMapPattern" />
<param index="1" name="index" type="int" default="-1" />
<description>
Adds a [TileMapPattern] to be stored in the TileSet resource. If provided, insert it at the given [param index].
</description>
</method>
<method name="add_physics_layer">
<return type="void" />
<param index="0" name="to_position" type="int" default="-1" />
<description>
Adds a physics layer to the TileSet at the given position [param to_position] in the array. If [param to_position] is -1, adds it at the end of the array.
Physics layers allow assigning collision polygons to atlas tiles.
</description>
</method>
<method name="add_source">
<return type="int" />
<param index="0" name="source" type="TileSetSource" />
<param index="1" name="atlas_source_id_override" type="int" default="-1" />
<description>
Adds a [TileSetSource] to the TileSet. If [param atlas_source_id_override] is not -1, also set its source ID. Otherwise, a unique identifier is automatically generated.
The function returns the added source ID or -1 if the source could not be added.
[b]Warning:[/b] A source cannot belong to two TileSets at the same time. If the added source was attached to another [TileSet], it will be removed from that one.
</description>
</method>
<method name="add_terrain">
<return type="void" />
<param index="0" name="terrain_set" type="int" />
<param index="1" name="to_position" type="int" default="-1" />
<description>
Adds a new terrain to the given terrain set [param terrain_set] at the given position [param to_position] in the array. If [param to_position] is -1, adds it at the end of the array.
</description>
</method>
<method name="add_terrain_set">
<return type="void" />
<param index="0" name="to_position" type="int" default="-1" />
<description>
Adds a new terrain set at the given position [param to_position] in the array. If [param to_position] is -1, adds it at the end of the array.
</description>
</method>
<method name="cleanup_invalid_tile_proxies">
<return type="void" />
<description>
Clears tile proxies pointing to invalid tiles.
</description>
</method>
<method name="clear_tile_proxies">
<return type="void" />
<description>
Clears all tile proxies.
</description>
</method>
<method name="get_alternative_level_tile_proxy">
<return type="Array" />
<param index="0" name="source_from" type="int" />
<param index="1" name="coords_from" type="Vector2i" />
<param index="2" name="alternative_from" type="int" />
<description>
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.
</description>
</method>
<method name="get_coords_level_tile_proxy">
<return type="Array" />
<param index="0" name="source_from" type="int" />
<param index="1" name="coords_from" type="Vector2i" />
<description>
Returns the coordinate-level proxy for the given identifiers. The returned array contains the two target identifiers of the proxy (source ID and atlas coordinates ID).
If the TileSet has no proxy for the given identifiers, returns an empty Array.
</description>
</method>
<method name="get_custom_data_layer_by_name" qualifiers="const">
<return type="int" />
<param index="0" name="layer_name" type="String" />
<description>
Returns the index of the custom data layer identified by the given name.
</description>
</method>
<method name="get_custom_data_layer_name" qualifiers="const">
<return type="String" />
<param index="0" name="layer_index" type="int" />
<description>
Returns the name of the custom data layer identified by the given index.
</description>
</method>
<method name="get_custom_data_layer_type" qualifiers="const">
<return type="int" enum="Variant.Type" />
<param index="0" name="layer_index" type="int" />
<description>
Returns the type of the custom data layer identified by the given index.
</description>
</method>
<method name="get_custom_data_layers_count" qualifiers="const">
<return type="int" />
<description>
Returns the custom data layers count.
</description>
</method>
<method name="get_navigation_layer_layer_value" qualifiers="const">
<return type="bool" />
<param index="0" name="layer_index" type="int" />
<param index="1" name="layer_number" type="int" />
<description>
Returns whether or not the specified navigation layer of the TileSet navigation data layer identified by the given [param layer_index] is enabled, given a navigation_layers [param layer_number] between 1 and 32.
</description>
</method>
<method name="get_navigation_layer_layers" qualifiers="const">
<return type="int" />
<param index="0" name="layer_index" type="int" />
<description>
Returns the navigation layers (as in the Navigation server) of the given TileSet navigation layer.
</description>
</method>
<method name="get_navigation_layers_count" qualifiers="const">
<return type="int" />
<description>
Returns the navigation layers count.
</description>
</method>
<method name="get_next_source_id" qualifiers="const">
<return type="int" />
<description>
Returns a new unused source ID. This generated ID is the same that a call to [method add_source] would return.
</description>
</method>
<method name="get_occlusion_layer_light_mask" qualifiers="const">
<return type="int" />
<param index="0" name="layer_index" type="int" />
<description>
Returns the light mask of the occlusion layer.
</description>
</method>
<method name="get_occlusion_layer_sdf_collision" qualifiers="const">
<return type="bool" />
<param index="0" name="layer_index" type="int" />
<description>
Returns if the occluders from this layer use [code]sdf_collision[/code].
</description>
</method>
<method name="get_occlusion_layers_count" qualifiers="const">
<return type="int" />
<description>
Returns the occlusion layers count.
</description>
</method>
<method name="get_pattern">
<return type="TileMapPattern" />
<param index="0" name="index" type="int" default="-1" />
<description>
Returns the [TileMapPattern] at the given [param index].
</description>
</method>
<method name="get_patterns_count">
<return type="int" />
<description>
Returns the number of [TileMapPattern] this tile set handles.
</description>
</method>
<method name="get_physics_layer_collision_layer" qualifiers="const">
<return type="int" />
<param index="0" name="layer_index" type="int" />
<description>
Returns the collision layer (as in the physics server) bodies on the given TileSet's physics layer are in.
</description>
</method>
<method name="get_physics_layer_collision_mask" qualifiers="const">
<return type="int" />
<param index="0" name="layer_index" type="int" />
<description>
Returns the collision mask of bodies on the given TileSet's physics layer.
</description>
</method>
<method name="get_physics_layer_physics_material" qualifiers="const">
<return type="PhysicsMaterial" />
<param index="0" name="layer_index" type="int" />
<description>
Returns the physics material of bodies on the given TileSet's physics layer.
</description>
</method>
<method name="get_physics_layers_count" qualifiers="const">
<return type="int" />
<description>
Returns the physics layers count.
</description>
</method>
<method name="get_source" qualifiers="const">
<return type="TileSetSource" />
<param index="0" name="source_id" type="int" />
<description>
Returns the [TileSetSource] with ID [param source_id].
</description>
</method>
<method name="get_source_count" qualifiers="const">
<return type="int" />
<description>
Returns the number of [TileSetSource] in this TileSet.
</description>
</method>
<method name="get_source_id" qualifiers="const">
<return type="int" />
<param index="0" name="index" type="int" />
<description>
Returns the source ID for source with index [param index].
</description>
</method>
<method name="get_source_level_tile_proxy">
<return type="int" />
<param index="0" name="source_from" type="int" />
<description>
Returns the source-level proxy for the given source identifier.
If the TileSet has no proxy for the given identifier, returns -1.
</description>
</method>
<method name="get_terrain_color" qualifiers="const">
<return type="Color" />
<param index="0" name="terrain_set" type="int" />
<param index="1" name="terrain_index" type="int" />
<description>
Returns a terrain's color.
</description>
</method>
<method name="get_terrain_name" qualifiers="const">
<return type="String" />
<param index="0" name="terrain_set" type="int" />
<param index="1" name="terrain_index" type="int" />
<description>
Returns a terrain's name.
</description>
</method>
<method name="get_terrain_set_mode" qualifiers="const">
<return type="int" enum="TileSet.TerrainMode" />
<param index="0" name="terrain_set" type="int" />
<description>
Returns a terrain set mode.
</description>
</method>
<method name="get_terrain_sets_count" qualifiers="const">
<return type="int" />
<description>
Returns the terrain sets count.
</description>
</method>
<method name="get_terrains_count" qualifiers="const">
<return type="int" />
<param index="0" name="terrain_set" type="int" />
<description>
Returns the number of terrains in the given terrain set.
</description>
</method>
<method name="has_alternative_level_tile_proxy">
<return type="bool" />
<param index="0" name="source_from" type="int" />
<param index="1" name="coords_from" type="Vector2i" />
<param index="2" name="alternative_from" type="int" />
<description>
Returns if there is an alternative-level proxy for the given identifiers.
</description>
</method>
<method name="has_coords_level_tile_proxy">
<return type="bool" />
<param index="0" name="source_from" type="int" />
<param index="1" name="coords_from" type="Vector2i" />
<description>
Returns if there is a coodinates-level proxy for the given identifiers.
</description>
</method>
<method name="has_source" qualifiers="const">
<return type="bool" />
<param index="0" name="source_id" type="int" />
<description>
Returns if this TileSet has a source for the given source ID.
</description>
</method>
<method name="has_source_level_tile_proxy">
<return type="bool" />
<param index="0" name="source_from" type="int" />
<description>
Returns if there is a source-level proxy for the given source ID.
</description>
</method>
<method name="map_tile_proxy" qualifiers="const">
<return type="Array" />
<param index="0" name="source_from" type="int" />
<param index="1" name="coords_from" type="Vector2i" />
<param index="2" name="alternative_from" type="int" />
<description>
According to the configured proxies, maps the provided identifiers 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.
</description>
</method>
<method name="move_custom_data_layer">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<param index="1" name="to_position" type="int" />
<description>
Moves the custom data layer at index [param layer_index] to the given position [param to_position] in the array. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="move_navigation_layer">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<param index="1" name="to_position" type="int" />
<description>
Moves the navigation layer at index [param layer_index] to the given position [param to_position] in the array. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="move_occlusion_layer">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<param index="1" name="to_position" type="int" />
<description>
Moves the occlusion layer at index [param layer_index] to the given position [param to_position] in the array. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="move_physics_layer">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<param index="1" name="to_position" type="int" />
<description>
Moves the physics layer at index [param layer_index] to the given position [param to_position] in the array. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="move_terrain">
<return type="void" />
<param index="0" name="terrain_set" type="int" />
<param index="1" name="terrain_index" type="int" />
<param index="2" name="to_position" type="int" />
<description>
Moves the terrain at index [param terrain_index] for terrain set [param terrain_set] to the given position [param to_position] in the array. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="move_terrain_set">
<return type="void" />
<param index="0" name="terrain_set" type="int" />
<param index="1" name="to_position" type="int" />
<description>
Moves the terrain set at index [param terrain_set] to the given position [param to_position] in the array. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="remove_alternative_level_tile_proxy">
<return type="void" />
<param index="0" name="source_from" type="int" />
<param index="1" name="coords_from" type="Vector2i" />
<param index="2" name="alternative_from" type="int" />
<description>
Removes an alternative-level proxy for the given identifiers.
</description>
</method>
<method name="remove_coords_level_tile_proxy">
<return type="void" />
<param index="0" name="source_from" type="int" />
<param index="1" name="coords_from" type="Vector2i" />
<description>
Removes a coordinates-level proxy for the given identifiers.
</description>
</method>
<method name="remove_custom_data_layer">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<description>
Removes the custom data layer at index [param layer_index]. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="remove_navigation_layer">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<description>
Removes the navigation layer at index [param layer_index]. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="remove_occlusion_layer">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<description>
Removes the occlusion layer at index [param layer_index]. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="remove_pattern">
<return type="void" />
<param index="0" name="index" type="int" />
<description>
Remove the [TileMapPattern] at the given index.
</description>
</method>
<method name="remove_physics_layer">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<description>
Removes the physics layer at index [param layer_index]. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="remove_source">
<return type="void" />
<param index="0" name="source_id" type="int" />
<description>
Removes the source with the given source ID.
</description>
</method>
<method name="remove_source_level_tile_proxy">
<return type="void" />
<param index="0" name="source_from" type="int" />
<description>
Removes a source-level tile proxy.
</description>
</method>
<method name="remove_terrain">
<return type="void" />
<param index="0" name="terrain_set" type="int" />
<param index="1" name="terrain_index" type="int" />
<description>
Removes the terrain at index [param terrain_index] in the given terrain set [param terrain_set]. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="remove_terrain_set">
<return type="void" />
<param index="0" name="terrain_set" type="int" />
<description>
Removes the terrain set at index [param terrain_set]. Also updates the atlas tiles accordingly.
</description>
</method>
<method name="set_alternative_level_tile_proxy">
<return type="void" />
<param index="0" name="source_from" type="int" />
<param index="1" name="coords_from" type="Vector2i" />
<param index="2" name="alternative_from" type="int" />
<param index="3" name="source_to" type="int" />
<param index="4" name="coords_to" type="Vector2i" />
<param index="5" name="alternative_to" type="int" />
<description>
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.
</description>
</method>
<method name="set_coords_level_tile_proxy">
<return type="void" />
<param index="0" name="p_source_from" type="int" />
<param index="1" name="coords_from" type="Vector2i" />
<param index="2" name="source_to" type="int" />
<param index="3" name="coords_to" type="Vector2i" />
<description>
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.
</description>
</method>
<method name="set_custom_data_layer_name">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<param index="1" name="layer_name" type="String" />
<description>
Sets the name of the custom data layer identified by the given index. Names are identifiers of the layer therefore if the name is already taken it will fail and raise an error.
</description>
</method>
<method name="set_custom_data_layer_type">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<param index="1" name="layer_type" type="int" enum="Variant.Type" />
<description>
Sets the type of the custom data layer identified by the given index.
</description>
</method>
<method name="set_navigation_layer_layer_value">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<param index="1" name="layer_number" type="int" />
<param index="2" name="value" type="bool" />
<description>
Based on [param value], enables or disables the specified navigation layer of the TileSet navigation data layer identified by the given [param layer_index], given a navigation_layers [param layer_number] between 1 and 32.
</description>
</method>
<method name="set_navigation_layer_layers">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<param index="1" name="layers" type="int" />
<description>
Sets the navigation layers (as in the navigation server) for navigation regions in the given TileSet navigation layer.
</description>
</method>
<method name="set_occlusion_layer_light_mask">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<param index="1" name="light_mask" type="int" />
<description>
Sets the occlusion layer (as in the rendering server) for occluders in the given TileSet occlusion layer.
</description>
</method>
<method name="set_occlusion_layer_sdf_collision">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<param index="1" name="sdf_collision" type="bool" />
<description>
Enables or disables SDF collision for occluders in the given TileSet occlusion layer.
</description>
</method>
<method name="set_physics_layer_collision_layer">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<param index="1" name="layer" type="int" />
<description>
Sets the physics layer (as in the physics server) for bodies in the given TileSet physics layer.
</description>
</method>
<method name="set_physics_layer_collision_mask">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<param index="1" name="mask" type="int" />
<description>
Sets the physics layer (as in the physics server) for bodies in the given TileSet physics layer.
</description>
</method>
<method name="set_physics_layer_physics_material">
<return type="void" />
<param index="0" name="layer_index" type="int" />
<param index="1" name="physics_material" type="PhysicsMaterial" />
<description>
Sets the physics material for bodies in the given TileSet physics layer.
</description>
</method>
<method name="set_source_id">
<return type="void" />
<param index="0" name="source_id" type="int" />
<param index="1" name="new_source_id" type="int" />
<description>
Changes a source's ID.
</description>
</method>
<method name="set_source_level_tile_proxy">
<return type="void" />
<param index="0" name="source_from" type="int" />
<param index="1" name="source_to" type="int" />
<description>
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 atlas 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.
</description>
</method>
<method name="set_terrain_color">
<return type="void" />
<param index="0" name="terrain_set" type="int" />
<param index="1" name="terrain_index" type="int" />
<param index="2" name="color" type="Color" />
<description>
Sets a terrain's color. This color is used for identifying the different terrains in the TileSet editor.
</description>
</method>
<method name="set_terrain_name">
<return type="void" />
<param index="0" name="terrain_set" type="int" />
<param index="1" name="terrain_index" type="int" />
<param index="2" name="name" type="String" />
<description>
Sets a terrain's name.
</description>
</method>
<method name="set_terrain_set_mode">
<return type="void" />
<param index="0" name="terrain_set" type="int" />
<param index="1" name="mode" type="int" enum="TileSet.TerrainMode" />
<description>
Sets a terrain mode. Each mode determines which bits of a tile shape is used to match the neighboring tiles' terrains.
</description>
</method>
</methods>
<members>
<member name="tile_layout" type="int" setter="set_tile_layout" getter="get_tile_layout" enum="TileSet.TileLayout" default="0">
For all half-offset shapes (Isometric, Hexagonal and Half-Offset square), changes the way tiles are indexed in the TileMap grid.
</member>
<member name="tile_offset_axis" type="int" setter="set_tile_offset_axis" getter="get_tile_offset_axis" enum="TileSet.TileOffsetAxis" default="0">
For all half-offset shapes (Isometric, Hexagonal and Half-Offset square), determines the offset axis.
</member>
<member name="tile_shape" type="int" setter="set_tile_shape" getter="get_tile_shape" enum="TileSet.TileShape" default="0">
The tile shape.
</member>
<member name="tile_size" type="Vector2i" setter="set_tile_size" getter="get_tile_size" default="Vector2i(16, 16)">
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.
</member>
<member name="uv_clipping" type="bool" setter="set_uv_clipping" getter="is_uv_clipping" default="false">
Enables/Disable uv clipping when rendering the tiles.
</member>
</members>
<constants>
<constant name="TILE_SHAPE_SQUARE" value="0" enum="TileShape">
Rectangular tile shape.
</constant>
<constant name="TILE_SHAPE_ISOMETRIC" value="1" enum="TileShape">
Diamond tile shape (for isometric look).
[b]Note:[/b] Isometric [TileSet] works best if [TileMap] and all its layers have Y-sort enabled.
</constant>
<constant name="TILE_SHAPE_HALF_OFFSET_SQUARE" value="2" enum="TileShape">
Rectangular tile shape with one row/column out of two offset by half a tile.
</constant>
<constant name="TILE_SHAPE_HEXAGON" value="3" enum="TileShape">
Hexagonal tile shape.
</constant>
<constant name="TILE_LAYOUT_STACKED" value="0" enum="TileLayout">
Tile coordinates layout where both axis stay consistent with their respective local horizontal and vertical axis.
</constant>
<constant name="TILE_LAYOUT_STACKED_OFFSET" value="1" enum="TileLayout">
Same as [constant TILE_LAYOUT_STACKED], but the first half-offset is negative instead of positive.
</constant>
<constant name="TILE_LAYOUT_STAIRS_RIGHT" value="2" enum="TileLayout">
Tile coordinates layout where the horizontal axis stay horizontal, and the vertical one goes down-right.
</constant>
<constant name="TILE_LAYOUT_STAIRS_DOWN" value="3" enum="TileLayout">
Tile coordinates layout where the vertical axis stay vertical, and the horizontal one goes down-right.
</constant>
<constant name="TILE_LAYOUT_DIAMOND_RIGHT" value="4" enum="TileLayout">
Tile coordinates layout where the horizontal axis goes up-right, and the vertical one goes down-right.
</constant>
<constant name="TILE_LAYOUT_DIAMOND_DOWN" value="5" enum="TileLayout">
Tile coordinates layout where the horizontal axis goes down-right, and the vertical one goes down-left.
</constant>
<constant name="TILE_OFFSET_AXIS_HORIZONTAL" value="0" enum="TileOffsetAxis">
Horizontal half-offset.
</constant>
<constant name="TILE_OFFSET_AXIS_VERTICAL" value="1" enum="TileOffsetAxis">
Vertical half-offset.
</constant>
<constant name="CELL_NEIGHBOR_RIGHT_SIDE" value="0" enum="CellNeighbor">
Neighbor on the right side.
</constant>
<constant name="CELL_NEIGHBOR_RIGHT_CORNER" value="1" enum="CellNeighbor">
Neighbor in the right corner.
</constant>
<constant name="CELL_NEIGHBOR_BOTTOM_RIGHT_SIDE" value="2" enum="CellNeighbor">
Neighbor on the bottom right side.
</constant>
<constant name="CELL_NEIGHBOR_BOTTOM_RIGHT_CORNER" value="3" enum="CellNeighbor">
Neighbor in the bottom right corner.
</constant>
<constant name="CELL_NEIGHBOR_BOTTOM_SIDE" value="4" enum="CellNeighbor">
Neighbor on the bottom side.
</constant>
<constant name="CELL_NEIGHBOR_BOTTOM_CORNER" value="5" enum="CellNeighbor">
Neighbor in the bottom corner.
</constant>
<constant name="CELL_NEIGHBOR_BOTTOM_LEFT_SIDE" value="6" enum="CellNeighbor">
Neighbor on the bottom left side.
</constant>
<constant name="CELL_NEIGHBOR_BOTTOM_LEFT_CORNER" value="7" enum="CellNeighbor">
Neighbor in the bottom left corner.
</constant>
<constant name="CELL_NEIGHBOR_LEFT_SIDE" value="8" enum="CellNeighbor">
Neighbor on the left side.
</constant>
<constant name="CELL_NEIGHBOR_LEFT_CORNER" value="9" enum="CellNeighbor">
Neighbor in the left corner.
</constant>
<constant name="CELL_NEIGHBOR_TOP_LEFT_SIDE" value="10" enum="CellNeighbor">
Neighbor on the top left side.
</constant>
<constant name="CELL_NEIGHBOR_TOP_LEFT_CORNER" value="11" enum="CellNeighbor">
Neighbor in the top left corner.
</constant>
<constant name="CELL_NEIGHBOR_TOP_SIDE" value="12" enum="CellNeighbor">
Neighbor on the top side.
</constant>
<constant name="CELL_NEIGHBOR_TOP_CORNER" value="13" enum="CellNeighbor">
Neighbor in the top corner.
</constant>
<constant name="CELL_NEIGHBOR_TOP_RIGHT_SIDE" value="14" enum="CellNeighbor">
Neighbor on the top right side.
</constant>
<constant name="CELL_NEIGHBOR_TOP_RIGHT_CORNER" value="15" enum="CellNeighbor">
Neighbor in the top right corner.
</constant>
<constant name="TERRAIN_MODE_MATCH_CORNERS_AND_SIDES" value="0" enum="TerrainMode">
Requires both corners and side to match with neighboring tiles' terrains.
</constant>
<constant name="TERRAIN_MODE_MATCH_CORNERS" value="1" enum="TerrainMode">
Requires corners to match with neighboring tiles' terrains.
</constant>
<constant name="TERRAIN_MODE_MATCH_SIDES" value="2" enum="TerrainMode">
Requires sides to match with neighboring tiles' terrains.
</constant>
</constants>
</class>

View File

@ -0,0 +1,306 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TileSetAtlasSource" inherits="TileSetSource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Exposes a 2D atlas texture as a set of tiles for a [TileSet] resource.
</brief_description>
<description>
An atlas is a grid of tiles laid out on a texture. Each tile in the grid must be exposed using [method create_tile]. Those tiles are then indexed using their coordinates in the grid.
Each tile can also have a size in the grid coordinates, making it more or less cells in the atlas.
Alternatives version of a tile can be created using [method create_alternative_tile], which are then indexed using an alternative ID. The main tile (the one in the grid), is accessed with an alternative ID equal to 0.
Each tile alternate has a set of properties that is defined by the source's [TileSet] layers. Those properties are stored in a TileData object that can be accessed and modified using [method get_tile_data].
As TileData properties are stored directly in the TileSetAtlasSource resource, their properties might also be set using [code]TileSetAtlasSource.set("&lt;coords_x&gt;:&lt;coords_y&gt;/&lt;alternative_id&gt;/&lt;tile_data_property&gt;")[/code].
</description>
<tutorials>
</tutorials>
<methods>
<method name="clear_tiles_outside_texture">
<return type="void" />
<description>
Removes all tiles that don't fit the available texture area. This method iterates over all the source's tiles, so it's advised to use [method has_tiles_outside_texture] beforehand.
</description>
</method>
<method name="create_alternative_tile">
<return type="int" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="alternative_id_override" type="int" default="-1" />
<description>
Creates an alternative tile for the tile at coordinates [param atlas_coords]. If [param alternative_id_override] is -1, give it an automatically generated unique ID, or assigns it the given ID otherwise.
Returns the new alternative identifier, or -1 if the alternative could not be created with a provided [param alternative_id_override].
</description>
</method>
<method name="create_tile">
<return type="void" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="size" type="Vector2i" default="Vector2i(1, 1)" />
<description>
Creates a new tile at coordinates [param atlas_coords] with the given [param size].
</description>
</method>
<method name="get_atlas_grid_size" qualifiers="const">
<return type="Vector2i" />
<description>
Returns the atlas grid size, which depends on how many tiles can fit in the texture. It thus depends on the [member texture]'s size, the atlas [member margins], and the tiles' [member texture_region_size].
</description>
</method>
<method name="get_next_alternative_tile_id" qualifiers="const">
<return type="int" />
<param index="0" name="atlas_coords" type="Vector2i" />
<description>
Returns the alternative ID a following call to [method create_alternative_tile] would return.
</description>
</method>
<method name="get_runtime_texture" qualifiers="const">
<return type="Texture2D" />
<description>
If [member use_texture_padding] is [code]false[/code], returns [member texture]. Otherwise, returns and internal [ImageTexture] created that includes the padding.
</description>
</method>
<method name="get_runtime_tile_texture_region" qualifiers="const">
<return type="Rect2i" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="frame" type="int" />
<description>
Returns the region of the tile at coordinates [param atlas_coords] for the given [param frame] inside the texture returned by [method get_runtime_texture].
[b]Note:[/b] If [member use_texture_padding] is [code]false[/code], returns the same as [method get_tile_texture_region].
</description>
</method>
<method name="get_tile_animation_columns" qualifiers="const">
<return type="int" />
<param index="0" name="atlas_coords" type="Vector2i" />
<description>
Returns how many columns the tile at [param atlas_coords] has in its animation layout.
</description>
</method>
<method name="get_tile_animation_frame_duration" qualifiers="const">
<return type="float" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="frame_index" type="int" />
<description>
Returns the animation frame duration of frame [param frame_index] for the tile at coordinates [param atlas_coords].
</description>
</method>
<method name="get_tile_animation_frames_count" qualifiers="const">
<return type="int" />
<param index="0" name="atlas_coords" type="Vector2i" />
<description>
Returns how many animation frames has the tile at coordinates [param atlas_coords].
</description>
</method>
<method name="get_tile_animation_mode" qualifiers="const">
<return type="int" enum="TileSetAtlasSource.TileAnimationMode" />
<param index="0" name="atlas_coords" type="Vector2i" />
<description>
Returns the tile animation mode of the tile at [param atlas_coords]. See also [method set_tile_animation_mode].
</description>
</method>
<method name="get_tile_animation_separation" qualifiers="const">
<return type="Vector2i" />
<param index="0" name="atlas_coords" type="Vector2i" />
<description>
Returns the separation (as in the atlas grid) between each frame of an animated tile at coordinates [param atlas_coords].
</description>
</method>
<method name="get_tile_animation_speed" qualifiers="const">
<return type="float" />
<param index="0" name="atlas_coords" type="Vector2i" />
<description>
Returns the animation speed of the tile at coordinates [param atlas_coords].
</description>
</method>
<method name="get_tile_animation_total_duration" qualifiers="const">
<return type="float" />
<param index="0" name="atlas_coords" type="Vector2i" />
<description>
Returns the sum of the sum of the frame durations of the tile at coordinates [param atlas_coords]. This value needs to be divided by the animation speed to get the actual animation loop duration.
</description>
</method>
<method name="get_tile_at_coords" qualifiers="const">
<return type="Vector2i" />
<param index="0" name="atlas_coords" type="Vector2i" />
<description>
If there is a tile covering the [param atlas_coords] coordinates, returns the top-left coordinates of the tile (thus its coordinate ID). Returns [code]Vector2i(-1, -1)[/code] otherwise.
</description>
</method>
<method name="get_tile_data" qualifiers="const">
<return type="TileData" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="alternative_tile" type="int" />
<description>
Returns the [TileData] object for the given atlas coordinates and alternative ID.
</description>
</method>
<method name="get_tile_size_in_atlas" qualifiers="const">
<return type="Vector2i" />
<param index="0" name="atlas_coords" type="Vector2i" />
<description>
Returns the size of the tile (in the grid coordinates system) at coordinates [param atlas_coords].
</description>
</method>
<method name="get_tile_texture_region" qualifiers="const">
<return type="Rect2i" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="frame" type="int" default="0" />
<description>
Returns a tile's texture region in the atlas texture. For animated tiles, a [param frame] argument might be provided for the different frames of the animation.
</description>
</method>
<method name="get_tiles_to_be_removed_on_change">
<return type="PackedVector2Array" />
<param index="0" name="texture" type="Texture2D" />
<param index="1" name="margins" type="Vector2i" />
<param index="2" name="separation" type="Vector2i" />
<param index="3" name="texture_region_size" type="Vector2i" />
<description>
Returns an array of tiles coordinates ID that will be automatically removed when modifying one or several of those properties: [param texture], [param margins], [param separation] or [param texture_region_size]. This can be used to undo changes that would have caused tiles data loss.
</description>
</method>
<method name="has_room_for_tile" qualifiers="const">
<return type="bool" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="size" type="Vector2i" />
<param index="2" name="animation_columns" type="int" />
<param index="3" name="animation_separation" type="Vector2i" />
<param index="4" name="frames_count" type="int" />
<param index="5" name="ignored_tile" type="Vector2i" default="Vector2i(-1, -1)" />
<description>
Returns whether there is enough room in an atlas to create/modify a tile with the given properties. If [param ignored_tile] is provided, act as is the given tile was not present in the atlas. This may be used when you want to modify a tile's properties.
</description>
</method>
<method name="has_tiles_outside_texture" qualifiers="const">
<return type="bool" />
<description>
Checks if the source has any tiles that don't fit the texture area (either partially or completely).
</description>
</method>
<method name="move_tile_in_atlas">
<return type="void" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="new_atlas_coords" type="Vector2i" default="Vector2i(-1, -1)" />
<param index="2" name="new_size" type="Vector2i" default="Vector2i(-1, -1)" />
<description>
Move the tile and its alternatives at the [param atlas_coords] coordinates to the [param new_atlas_coords] coordinates with the [param new_size] size. This functions will fail if a tile is already present in the given area.
If [param new_atlas_coords] is [code]Vector2i(-1, -1)[/code], keeps the tile's coordinates. If [param new_size] is [code]Vector2i(-1, -1)[/code], keeps the tile's size.
To avoid an error, first check if a move is possible using [method has_room_for_tile].
</description>
</method>
<method name="remove_alternative_tile">
<return type="void" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="alternative_tile" type="int" />
<description>
Remove a tile's alternative with alternative ID [param alternative_tile].
Calling this function with [param alternative_tile] equals to 0 will fail, as the base tile alternative cannot be removed.
</description>
</method>
<method name="remove_tile">
<return type="void" />
<param index="0" name="atlas_coords" type="Vector2i" />
<description>
Remove a tile and its alternative at coordinates [param atlas_coords].
</description>
</method>
<method name="set_alternative_tile_id">
<return type="void" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="alternative_tile" type="int" />
<param index="2" name="new_id" type="int" />
<description>
Change a tile's alternative ID from [param alternative_tile] to [param new_id].
Calling this function with [param new_id] of 0 will fail, as the base tile alternative cannot be moved.
</description>
</method>
<method name="set_tile_animation_columns">
<return type="void" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="frame_columns" type="int" />
<description>
Sets the number of columns in the animation layout of the tile at coordinates [param atlas_coords]. If set to 0, then the different frames of the animation are laid out as a single horizontal line in the atlas.
</description>
</method>
<method name="set_tile_animation_frame_duration">
<return type="void" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="frame_index" type="int" />
<param index="2" name="duration" type="float" />
<description>
Sets the animation frame [param duration] of frame [param frame_index] for the tile at coordinates [param atlas_coords].
</description>
</method>
<method name="set_tile_animation_frames_count">
<return type="void" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="frames_count" type="int" />
<description>
Sets how many animation frames the tile at coordinates [param atlas_coords] has.
</description>
</method>
<method name="set_tile_animation_mode">
<return type="void" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="mode" type="int" enum="TileSetAtlasSource.TileAnimationMode" />
<description>
Sets the tile animation mode of the tile at [param atlas_coords] to [param mode]. See also [method get_tile_animation_mode].
</description>
</method>
<method name="set_tile_animation_separation">
<return type="void" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="separation" type="Vector2i" />
<description>
Sets the margin (in grid tiles) between each tile in the animation layout of the tile at coordinates [param atlas_coords] has.
</description>
</method>
<method name="set_tile_animation_speed">
<return type="void" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="speed" type="float" />
<description>
Sets the animation speed of the tile at coordinates [param atlas_coords] has.
</description>
</method>
</methods>
<members>
<member name="margins" type="Vector2i" setter="set_margins" getter="get_margins" default="Vector2i(0, 0)">
Margins, in pixels, to offset the origin of the grid in the texture.
</member>
<member name="separation" type="Vector2i" setter="set_separation" getter="get_separation" default="Vector2i(0, 0)">
Separation, in pixels, between each tile texture region of the grid.
</member>
<member name="texture" type="Texture2D" setter="set_texture" getter="get_texture">
The atlas texture.
</member>
<member name="texture_region_size" type="Vector2i" setter="set_texture_region_size" getter="get_texture_region_size" default="Vector2i(16, 16)">
The base tile size in the texture (in pixel). This size must be bigger than the TileSet's [code]tile_size[/code] value.
</member>
<member name="use_texture_padding" type="bool" setter="set_use_texture_padding" getter="get_use_texture_padding" default="true">
If [code]true[/code], generates an internal texture with an additional one pixel padding around each tile. Texture padding avoids a common artifact where lines appear between tiles.
Disabling this setting might lead a small performance improvement, as generating the internal texture requires both memory and processing time when the TileSetAtlasSource resource is modified.
</member>
</members>
<constants>
<constant name="TILE_ANIMATION_MODE_DEFAULT" value="0" enum="TileAnimationMode">
Tile animations start at same time, looking identical.
</constant>
<constant name="TILE_ANIMATION_MODE_RANDOM_START_TIMES" value="1" enum="TileAnimationMode">
Tile animations start at random times, looking varied.
</constant>
<constant name="TILE_ANIMATION_MODE_MAX" value="2" enum="TileAnimationMode">
Represents the size of the [enum TileAnimationMode] enum.
</constant>
<constant name="TRANSFORM_FLIP_H" value="4096">
Represents cell's horizontal flip flag. Should be used directly with [TileMap] to flip placed tiles by altering their alternative IDs.
[codeblock]
var alternate_id = $TileMap.get_cell_alternative_tile(0, Vector2i(2, 2))
if not alternate_id &amp; TileSetAtlasSource.TRANSFORM_FLIP_H:
# If tile is not already flipped, flip it.
$TileMap.set_cell(0, Vector2i(2, 2), source_id, atlas_coords, alternate_id | TileSetAtlasSource.TRANSFORM_FLIP_H)
[/codeblock]
</constant>
<constant name="TRANSFORM_FLIP_V" value="8192">
Represents cell's vertical flip flag. See [constant TRANSFORM_FLIP_H] for usage.
</constant>
<constant name="TRANSFORM_TRANSPOSE" value="16384">
Represents cell's transposed flag. See [constant TRANSFORM_FLIP_H] for usage.
</constant>
</constants>
</class>

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TileSetScenesCollectionSource" inherits="TileSetSource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Exposes a set of scenes as tiles for a [TileSet] resource.
</brief_description>
<description>
When placed on a [TileMap], tiles from [TileSetScenesCollectionSource] will automatically instantiate an associated scene at the cell's position in the TileMap.
Scenes are instantiated as children of the [TileMap] when it enters the tree. If you add/remove a scene tile in the [TileMap] that is already inside the tree, the [TileMap] will automatically instantiate/free the scene accordingly.
</description>
<tutorials>
</tutorials>
<methods>
<method name="create_scene_tile">
<return type="int" />
<param index="0" name="packed_scene" type="PackedScene" />
<param index="1" name="id_override" type="int" default="-1" />
<description>
Creates a scene-based tile out of the given scene.
Returns a newly generated unique ID.
</description>
</method>
<method name="get_next_scene_tile_id" qualifiers="const">
<return type="int" />
<description>
Returns the scene ID a following call to [method create_scene_tile] would return.
</description>
</method>
<method name="get_scene_tile_display_placeholder" qualifiers="const">
<return type="bool" />
<param index="0" name="id" type="int" />
<description>
Returns whether the scene tile with [param id] displays a placeholder in the editor.
</description>
</method>
<method name="get_scene_tile_id">
<return type="int" />
<param index="0" name="index" type="int" />
<description>
Returns the scene tile ID of the scene tile at [param index].
</description>
</method>
<method name="get_scene_tile_scene" qualifiers="const">
<return type="PackedScene" />
<param index="0" name="id" type="int" />
<description>
Returns the [PackedScene] resource of scene tile with [param id].
</description>
</method>
<method name="get_scene_tiles_count">
<return type="int" />
<description>
Returns the number or scene tiles this TileSet source has.
</description>
</method>
<method name="has_scene_tile_id">
<return type="bool" />
<param index="0" name="id" type="int" />
<description>
Returns whether this TileSet source has a scene tile with [param id].
</description>
</method>
<method name="remove_scene_tile">
<return type="void" />
<param index="0" name="id" type="int" />
<description>
Remove the scene tile with [param id].
</description>
</method>
<method name="set_scene_tile_display_placeholder">
<return type="void" />
<param index="0" name="id" type="int" />
<param index="1" name="display_placeholder" type="bool" />
<description>
Sets whether or not the scene tile with [param id] should display a placeholder in the editor. This might be useful for scenes that are not visible.
</description>
</method>
<method name="set_scene_tile_id">
<return type="void" />
<param index="0" name="id" type="int" />
<param index="1" name="new_id" type="int" />
<description>
Changes a scene tile's ID from [param id] to [param new_id]. This will fail if there is already a tile with an ID equal to [param new_id].
</description>
</method>
<method name="set_scene_tile_scene">
<return type="void" />
<param index="0" name="id" type="int" />
<param index="1" name="packed_scene" type="PackedScene" />
<description>
Assigns a [PackedScene] resource to the scene tile with [param id]. This will fail if the scene does not extend CanvasItem, as positioning properties are needed to place the scene on the TileMap.
</description>
</method>
</methods>
</class>

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TileSetSource" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Exposes a set of tiles for a [TileSet] resource.
</brief_description>
<description>
Exposes a set of tiles for a [TileSet] resource.
Tiles in a source are indexed with two IDs, coordinates ID (of type Vector2i) and an alternative ID (of type int), named according to their use in the [TileSetAtlasSource] class.
Depending on the TileSet source type, those IDs might have restrictions on their values, this is why the base [TileSetSource] class only exposes getters for them.
You can iterate over all tiles exposed by a TileSetSource by first iterating over coordinates IDs using [method get_tiles_count] and [method get_tile_id], then over alternative IDs using [method get_alternative_tiles_count] and [method get_alternative_tile_id].
[b]Warning:[/b] [TileSetSource] can only be added to one TileSet at the same time. Calling [method TileSet.add_source] on a second [TileSet] will remove the source from the first one.
</description>
<tutorials>
</tutorials>
<methods>
<method name="get_alternative_tile_id" qualifiers="const">
<return type="int" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="index" type="int" />
<description>
Returns the alternative ID for the tile with coordinates ID [param atlas_coords] at index [param index].
</description>
</method>
<method name="get_alternative_tiles_count" qualifiers="const">
<return type="int" />
<param index="0" name="atlas_coords" type="Vector2i" />
<description>
Returns the number of alternatives tiles for the coordinates ID [param atlas_coords].
For [TileSetAtlasSource], this always return at least 1, as the base tile with ID 0 is always part of the alternatives list.
Returns -1 if there is not tile at the given coords.
</description>
</method>
<method name="get_tile_id" qualifiers="const">
<return type="Vector2i" />
<param index="0" name="index" type="int" />
<description>
Returns the tile coordinates ID of the tile with index [param index].
</description>
</method>
<method name="get_tiles_count" qualifiers="const">
<return type="int" />
<description>
Returns how many tiles this atlas source defines (not including alternative tiles).
</description>
</method>
<method name="has_alternative_tile" qualifiers="const">
<return type="bool" />
<param index="0" name="atlas_coords" type="Vector2i" />
<param index="1" name="alternative_tile" type="int" />
<description>
Returns if the base tile at coordinates [param atlas_coords] has an alternative with ID [param alternative_tile].
</description>
</method>
<method name="has_tile" qualifiers="const">
<return type="bool" />
<param index="0" name="atlas_coords" type="Vector2i" />
<description>
Returns if this atlas has a tile with coordinates ID [param atlas_coords].
</description>
</method>
</methods>
</class>