class_tilemaplayer.rst 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/TileMapLayer.xml.
  6. .. _class_TileMapLayer:
  7. TileMapLayer
  8. ============
  9. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Node for 2D tile-based maps.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Node for 2D tile-based maps. A **TileMapLayer** uses a :ref:`TileSet<class_TileSet>` which contain a list of tiles which are used to create grid-based maps. Unlike the :ref:`TileMap<class_TileMap>` node, which is deprecated, **TileMapLayer** has only one layer of tiles. You can use several **TileMapLayer** to achieve the same result as a :ref:`TileMap<class_TileMap>` node.
  15. For performance reasons, all TileMap updates are batched at the end of a frame. Notably, this means that scene tiles from a :ref:`TileSetScenesCollectionSource<class_TileSetScenesCollectionSource>` are initialized after their parent. This is only queued when inside the scene tree.
  16. To force an update earlier on, call :ref:`update_internals()<class_TileMapLayer_method_update_internals>`.
  17. \ **Note:** For performance and compatibility reasons, the coordinates serialized by **TileMapLayer** are limited to 16-bit signed integers, i.e. the range for X and Y coordinates is from ``-32768`` to ``32767``. When saving tile data, tiles outside this range are wrapped.
  18. .. rst-class:: classref-introduction-group
  19. Tutorials
  20. ---------
  21. - :doc:`Using Tilemaps <../tutorials/2d/using_tilemaps>`
  22. - `2D Platformer Demo <https://godotengine.org/asset-library/asset/2727>`__
  23. - `2D Isometric Demo <https://godotengine.org/asset-library/asset/2718>`__
  24. - `2D Hexagonal Demo <https://godotengine.org/asset-library/asset/2717>`__
  25. - `2D Grid-based Navigation with AStarGrid2D Demo <https://godotengine.org/asset-library/asset/2723>`__
  26. - `2D Role Playing Game (RPG) Demo <https://godotengine.org/asset-library/asset/2729>`__
  27. - `2D Kinematic Character Demo <https://godotengine.org/asset-library/asset/2719>`__
  28. - `2D Dynamic TileMap Layers Demo <https://godotengine.org/asset-library/asset/2713>`__
  29. .. rst-class:: classref-reftable-group
  30. Properties
  31. ----------
  32. .. table::
  33. :widths: auto
  34. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------+
  35. | :ref:`bool<class_bool>` | :ref:`collision_enabled<class_TileMapLayer_property_collision_enabled>` | ``true`` |
  36. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------+
  37. | :ref:`DebugVisibilityMode<enum_TileMapLayer_DebugVisibilityMode>` | :ref:`collision_visibility_mode<class_TileMapLayer_property_collision_visibility_mode>` | ``0`` |
  38. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------+
  39. | :ref:`bool<class_bool>` | :ref:`enabled<class_TileMapLayer_property_enabled>` | ``true`` |
  40. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------+
  41. | :ref:`bool<class_bool>` | :ref:`navigation_enabled<class_TileMapLayer_property_navigation_enabled>` | ``true`` |
  42. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------+
  43. | :ref:`DebugVisibilityMode<enum_TileMapLayer_DebugVisibilityMode>` | :ref:`navigation_visibility_mode<class_TileMapLayer_property_navigation_visibility_mode>` | ``0`` |
  44. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------+
  45. | :ref:`bool<class_bool>` | :ref:`occlusion_enabled<class_TileMapLayer_property_occlusion_enabled>` | ``true`` |
  46. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------+
  47. | :ref:`int<class_int>` | :ref:`physics_quadrant_size<class_TileMapLayer_property_physics_quadrant_size>` | ``16`` |
  48. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------+
  49. | :ref:`int<class_int>` | :ref:`rendering_quadrant_size<class_TileMapLayer_property_rendering_quadrant_size>` | ``16`` |
  50. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------+
  51. | :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`tile_map_data<class_TileMapLayer_property_tile_map_data>` | ``PackedByteArray()`` |
  52. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------+
  53. | :ref:`TileSet<class_TileSet>` | :ref:`tile_set<class_TileMapLayer_property_tile_set>` | |
  54. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------+
  55. | :ref:`bool<class_bool>` | :ref:`use_kinematic_bodies<class_TileMapLayer_property_use_kinematic_bodies>` | ``false`` |
  56. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------+
  57. | :ref:`bool<class_bool>` | :ref:`x_draw_order_reversed<class_TileMapLayer_property_x_draw_order_reversed>` | ``false`` |
  58. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------+
  59. | :ref:`int<class_int>` | :ref:`y_sort_origin<class_TileMapLayer_property_y_sort_origin>` | ``0`` |
  60. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------+
  61. .. rst-class:: classref-reftable-group
  62. Methods
  63. -------
  64. .. table::
  65. :widths: auto
  66. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | |void| | :ref:`_tile_data_runtime_update<class_TileMapLayer_private_method__tile_data_runtime_update>`\ (\ coords\: :ref:`Vector2i<class_Vector2i>`, tile_data\: :ref:`TileData<class_TileData>`\ ) |virtual| |
  68. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | |void| | :ref:`_update_cells<class_TileMapLayer_private_method__update_cells>`\ (\ coords\: :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\], forced_cleanup\: :ref:`bool<class_bool>`\ ) |virtual| |
  70. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :ref:`bool<class_bool>` | :ref:`_use_tile_data_runtime_update<class_TileMapLayer_private_method__use_tile_data_runtime_update>`\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |virtual| |
  72. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | |void| | :ref:`clear<class_TileMapLayer_method_clear>`\ (\ ) |
  74. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | |void| | :ref:`erase_cell<class_TileMapLayer_method_erase_cell>`\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |
  76. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | |void| | :ref:`fix_invalid_tiles<class_TileMapLayer_method_fix_invalid_tiles>`\ (\ ) |
  78. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`int<class_int>` | :ref:`get_cell_alternative_tile<class_TileMapLayer_method_get_cell_alternative_tile>`\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
  80. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`Vector2i<class_Vector2i>` | :ref:`get_cell_atlas_coords<class_TileMapLayer_method_get_cell_atlas_coords>`\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
  82. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`int<class_int>` | :ref:`get_cell_source_id<class_TileMapLayer_method_get_cell_source_id>`\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
  84. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`TileData<class_TileData>` | :ref:`get_cell_tile_data<class_TileMapLayer_method_get_cell_tile_data>`\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
  86. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | :ref:`Vector2i<class_Vector2i>` | :ref:`get_coords_for_body_rid<class_TileMapLayer_method_get_coords_for_body_rid>`\ (\ body\: :ref:`RID<class_RID>`\ ) |const| |
  88. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | :ref:`RID<class_RID>` | :ref:`get_navigation_map<class_TileMapLayer_method_get_navigation_map>`\ (\ ) |const| |
  90. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`Vector2i<class_Vector2i>` | :ref:`get_neighbor_cell<class_TileMapLayer_method_get_neighbor_cell>`\ (\ coords\: :ref:`Vector2i<class_Vector2i>`, neighbor\: :ref:`CellNeighbor<enum_TileSet_CellNeighbor>`\ ) |const| |
  92. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`TileMapPattern<class_TileMapPattern>` | :ref:`get_pattern<class_TileMapLayer_method_get_pattern>`\ (\ coords_array\: :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\]\ ) |
  94. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\] | :ref:`get_surrounding_cells<class_TileMapLayer_method_get_surrounding_cells>`\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |
  96. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\] | :ref:`get_used_cells<class_TileMapLayer_method_get_used_cells>`\ (\ ) |const| |
  98. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\] | :ref:`get_used_cells_by_id<class_TileMapLayer_method_get_used_cells_by_id>`\ (\ source_id\: :ref:`int<class_int>` = -1, atlas_coords\: :ref:`Vector2i<class_Vector2i>` = Vector2i(-1, -1), alternative_tile\: :ref:`int<class_int>` = -1\ ) |const| |
  100. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | :ref:`Rect2i<class_Rect2i>` | :ref:`get_used_rect<class_TileMapLayer_method_get_used_rect>`\ (\ ) |const| |
  102. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`bool<class_bool>` | :ref:`has_body_rid<class_TileMapLayer_method_has_body_rid>`\ (\ body\: :ref:`RID<class_RID>`\ ) |const| |
  104. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`bool<class_bool>` | :ref:`is_cell_flipped_h<class_TileMapLayer_method_is_cell_flipped_h>`\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
  106. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`bool<class_bool>` | :ref:`is_cell_flipped_v<class_TileMapLayer_method_is_cell_flipped_v>`\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
  108. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | :ref:`bool<class_bool>` | :ref:`is_cell_transposed<class_TileMapLayer_method_is_cell_transposed>`\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
  110. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | :ref:`Vector2i<class_Vector2i>` | :ref:`local_to_map<class_TileMapLayer_method_local_to_map>`\ (\ local_position\: :ref:`Vector2<class_Vector2>`\ ) |const| |
  112. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | :ref:`Vector2i<class_Vector2i>` | :ref:`map_pattern<class_TileMapLayer_method_map_pattern>`\ (\ position_in_tilemap\: :ref:`Vector2i<class_Vector2i>`, coords_in_pattern\: :ref:`Vector2i<class_Vector2i>`, pattern\: :ref:`TileMapPattern<class_TileMapPattern>`\ ) |
  114. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | :ref:`Vector2<class_Vector2>` | :ref:`map_to_local<class_TileMapLayer_method_map_to_local>`\ (\ map_position\: :ref:`Vector2i<class_Vector2i>`\ ) |const| |
  116. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | |void| | :ref:`notify_runtime_tile_data_update<class_TileMapLayer_method_notify_runtime_tile_data_update>`\ (\ ) |
  118. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. | |void| | :ref:`set_cell<class_TileMapLayer_method_set_cell>`\ (\ coords\: :ref:`Vector2i<class_Vector2i>`, source_id\: :ref:`int<class_int>` = -1, atlas_coords\: :ref:`Vector2i<class_Vector2i>` = Vector2i(-1, -1), alternative_tile\: :ref:`int<class_int>` = 0\ ) |
  120. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  121. | |void| | :ref:`set_cells_terrain_connect<class_TileMapLayer_method_set_cells_terrain_connect>`\ (\ cells\: :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\], terrain_set\: :ref:`int<class_int>`, terrain\: :ref:`int<class_int>`, ignore_empty_terrains\: :ref:`bool<class_bool>` = true\ ) |
  122. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  123. | |void| | :ref:`set_cells_terrain_path<class_TileMapLayer_method_set_cells_terrain_path>`\ (\ path\: :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\], terrain_set\: :ref:`int<class_int>`, terrain\: :ref:`int<class_int>`, ignore_empty_terrains\: :ref:`bool<class_bool>` = true\ ) |
  124. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  125. | |void| | :ref:`set_navigation_map<class_TileMapLayer_method_set_navigation_map>`\ (\ map\: :ref:`RID<class_RID>`\ ) |
  126. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  127. | |void| | :ref:`set_pattern<class_TileMapLayer_method_set_pattern>`\ (\ position\: :ref:`Vector2i<class_Vector2i>`, pattern\: :ref:`TileMapPattern<class_TileMapPattern>`\ ) |
  128. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | |void| | :ref:`update_internals<class_TileMapLayer_method_update_internals>`\ (\ ) |
  130. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. .. rst-class:: classref-section-separator
  132. ----
  133. .. rst-class:: classref-descriptions-group
  134. Signals
  135. -------
  136. .. _class_TileMapLayer_signal_changed:
  137. .. rst-class:: classref-signal
  138. **changed**\ (\ ) :ref:`🔗<class_TileMapLayer_signal_changed>`
  139. Emitted when this **TileMapLayer**'s properties changes. This includes modified cells, properties, or changes made to its assigned :ref:`TileSet<class_TileSet>`.
  140. \ **Note:** This signal may be emitted very often when batch-modifying a **TileMapLayer**. Avoid executing complex processing in a connected function, and consider delaying it to the end of the frame instead (i.e. calling :ref:`Object.call_deferred()<class_Object_method_call_deferred>`).
  141. .. rst-class:: classref-section-separator
  142. ----
  143. .. rst-class:: classref-descriptions-group
  144. Enumerations
  145. ------------
  146. .. _enum_TileMapLayer_DebugVisibilityMode:
  147. .. rst-class:: classref-enumeration
  148. enum **DebugVisibilityMode**: :ref:`🔗<enum_TileMapLayer_DebugVisibilityMode>`
  149. .. _class_TileMapLayer_constant_DEBUG_VISIBILITY_MODE_DEFAULT:
  150. .. rst-class:: classref-enumeration-constant
  151. :ref:`DebugVisibilityMode<enum_TileMapLayer_DebugVisibilityMode>` **DEBUG_VISIBILITY_MODE_DEFAULT** = ``0``
  152. Hide the collisions or navigation debug shapes in the editor, and use the debug settings to determine their visibility in game (i.e. :ref:`SceneTree.debug_collisions_hint<class_SceneTree_property_debug_collisions_hint>` or :ref:`SceneTree.debug_navigation_hint<class_SceneTree_property_debug_navigation_hint>`).
  153. .. _class_TileMapLayer_constant_DEBUG_VISIBILITY_MODE_FORCE_HIDE:
  154. .. rst-class:: classref-enumeration-constant
  155. :ref:`DebugVisibilityMode<enum_TileMapLayer_DebugVisibilityMode>` **DEBUG_VISIBILITY_MODE_FORCE_HIDE** = ``2``
  156. Always hide the collisions or navigation debug shapes.
  157. .. _class_TileMapLayer_constant_DEBUG_VISIBILITY_MODE_FORCE_SHOW:
  158. .. rst-class:: classref-enumeration-constant
  159. :ref:`DebugVisibilityMode<enum_TileMapLayer_DebugVisibilityMode>` **DEBUG_VISIBILITY_MODE_FORCE_SHOW** = ``1``
  160. Always show the collisions or navigation debug shapes.
  161. .. rst-class:: classref-section-separator
  162. ----
  163. .. rst-class:: classref-descriptions-group
  164. Property Descriptions
  165. ---------------------
  166. .. _class_TileMapLayer_property_collision_enabled:
  167. .. rst-class:: classref-property
  168. :ref:`bool<class_bool>` **collision_enabled** = ``true`` :ref:`🔗<class_TileMapLayer_property_collision_enabled>`
  169. .. rst-class:: classref-property-setget
  170. - |void| **set_collision_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  171. - :ref:`bool<class_bool>` **is_collision_enabled**\ (\ )
  172. Enable or disable collisions.
  173. .. rst-class:: classref-item-separator
  174. ----
  175. .. _class_TileMapLayer_property_collision_visibility_mode:
  176. .. rst-class:: classref-property
  177. :ref:`DebugVisibilityMode<enum_TileMapLayer_DebugVisibilityMode>` **collision_visibility_mode** = ``0`` :ref:`🔗<class_TileMapLayer_property_collision_visibility_mode>`
  178. .. rst-class:: classref-property-setget
  179. - |void| **set_collision_visibility_mode**\ (\ value\: :ref:`DebugVisibilityMode<enum_TileMapLayer_DebugVisibilityMode>`\ )
  180. - :ref:`DebugVisibilityMode<enum_TileMapLayer_DebugVisibilityMode>` **get_collision_visibility_mode**\ (\ )
  181. Show or hide the **TileMapLayer**'s collision shapes. If set to :ref:`DEBUG_VISIBILITY_MODE_DEFAULT<class_TileMapLayer_constant_DEBUG_VISIBILITY_MODE_DEFAULT>`, this depends on the show collision debug settings.
  182. .. rst-class:: classref-item-separator
  183. ----
  184. .. _class_TileMapLayer_property_enabled:
  185. .. rst-class:: classref-property
  186. :ref:`bool<class_bool>` **enabled** = ``true`` :ref:`🔗<class_TileMapLayer_property_enabled>`
  187. .. rst-class:: classref-property-setget
  188. - |void| **set_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  189. - :ref:`bool<class_bool>` **is_enabled**\ (\ )
  190. If ``false``, disables this **TileMapLayer** completely (rendering, collision, navigation, scene tiles, etc.)
  191. .. rst-class:: classref-item-separator
  192. ----
  193. .. _class_TileMapLayer_property_navigation_enabled:
  194. .. rst-class:: classref-property
  195. :ref:`bool<class_bool>` **navigation_enabled** = ``true`` :ref:`🔗<class_TileMapLayer_property_navigation_enabled>`
  196. .. rst-class:: classref-property-setget
  197. - |void| **set_navigation_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  198. - :ref:`bool<class_bool>` **is_navigation_enabled**\ (\ )
  199. If ``true``, navigation regions are enabled.
  200. .. rst-class:: classref-item-separator
  201. ----
  202. .. _class_TileMapLayer_property_navigation_visibility_mode:
  203. .. rst-class:: classref-property
  204. :ref:`DebugVisibilityMode<enum_TileMapLayer_DebugVisibilityMode>` **navigation_visibility_mode** = ``0`` :ref:`🔗<class_TileMapLayer_property_navigation_visibility_mode>`
  205. .. rst-class:: classref-property-setget
  206. - |void| **set_navigation_visibility_mode**\ (\ value\: :ref:`DebugVisibilityMode<enum_TileMapLayer_DebugVisibilityMode>`\ )
  207. - :ref:`DebugVisibilityMode<enum_TileMapLayer_DebugVisibilityMode>` **get_navigation_visibility_mode**\ (\ )
  208. Show or hide the **TileMapLayer**'s navigation meshes. If set to :ref:`DEBUG_VISIBILITY_MODE_DEFAULT<class_TileMapLayer_constant_DEBUG_VISIBILITY_MODE_DEFAULT>`, this depends on the show navigation debug settings.
  209. .. rst-class:: classref-item-separator
  210. ----
  211. .. _class_TileMapLayer_property_occlusion_enabled:
  212. .. rst-class:: classref-property
  213. :ref:`bool<class_bool>` **occlusion_enabled** = ``true`` :ref:`🔗<class_TileMapLayer_property_occlusion_enabled>`
  214. .. rst-class:: classref-property-setget
  215. - |void| **set_occlusion_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  216. - :ref:`bool<class_bool>` **is_occlusion_enabled**\ (\ )
  217. Enable or disable light occlusion.
  218. .. rst-class:: classref-item-separator
  219. ----
  220. .. _class_TileMapLayer_property_physics_quadrant_size:
  221. .. rst-class:: classref-property
  222. :ref:`int<class_int>` **physics_quadrant_size** = ``16`` :ref:`🔗<class_TileMapLayer_property_physics_quadrant_size>`
  223. .. rst-class:: classref-property-setget
  224. - |void| **set_physics_quadrant_size**\ (\ value\: :ref:`int<class_int>`\ )
  225. - :ref:`int<class_int>` **get_physics_quadrant_size**\ (\ )
  226. The **TileMapLayer**'s physics quadrant size. Within a physics quadrant, cells with similar physics properties are grouped together and their collision shapes get merged. :ref:`physics_quadrant_size<class_TileMapLayer_property_physics_quadrant_size>` defines the length of a square's side, in the map's coordinate system, that forms the quadrant. Thus, the default quadrant size groups together ``16 * 16 = 256`` tiles.
  227. \ **Note:** As quadrants are created according to the map's coordinate system, the quadrant's "square shape" might not look like square in the **TileMapLayer**'s local coordinate system.
  228. \ **Note:** This impacts the value returned by :ref:`get_coords_for_body_rid()<class_TileMapLayer_method_get_coords_for_body_rid>`.
  229. .. rst-class:: classref-item-separator
  230. ----
  231. .. _class_TileMapLayer_property_rendering_quadrant_size:
  232. .. rst-class:: classref-property
  233. :ref:`int<class_int>` **rendering_quadrant_size** = ``16`` :ref:`🔗<class_TileMapLayer_property_rendering_quadrant_size>`
  234. .. rst-class:: classref-property-setget
  235. - |void| **set_rendering_quadrant_size**\ (\ value\: :ref:`int<class_int>`\ )
  236. - :ref:`int<class_int>` **get_rendering_quadrant_size**\ (\ )
  237. The **TileMapLayer**'s rendering quadrant size. A quadrant is a group of tiles to be drawn together on a single canvas item, for optimization purposes. :ref:`rendering_quadrant_size<class_TileMapLayer_property_rendering_quadrant_size>` defines the length of a square's side, in the map's coordinate system, that forms the quadrant. Thus, the default quadrant size groups together ``16 * 16 = 256`` tiles.
  238. The quadrant size does not apply on a Y-sorted **TileMapLayer**, as tiles are grouped by Y position instead in that case.
  239. \ **Note:** As quadrants are created according to the map's coordinate system, the quadrant's "square shape" might not look like square in the **TileMapLayer**'s local coordinate system.
  240. .. rst-class:: classref-item-separator
  241. ----
  242. .. _class_TileMapLayer_property_tile_map_data:
  243. .. rst-class:: classref-property
  244. :ref:`PackedByteArray<class_PackedByteArray>` **tile_map_data** = ``PackedByteArray()`` :ref:`🔗<class_TileMapLayer_property_tile_map_data>`
  245. .. rst-class:: classref-property-setget
  246. - |void| **set_tile_map_data_from_array**\ (\ value\: :ref:`PackedByteArray<class_PackedByteArray>`\ )
  247. - :ref:`PackedByteArray<class_PackedByteArray>` **get_tile_map_data_as_array**\ (\ )
  248. The raw tile map data as a byte array.
  249. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedByteArray<class_PackedByteArray>` for more details.
  250. .. rst-class:: classref-item-separator
  251. ----
  252. .. _class_TileMapLayer_property_tile_set:
  253. .. rst-class:: classref-property
  254. :ref:`TileSet<class_TileSet>` **tile_set** :ref:`🔗<class_TileMapLayer_property_tile_set>`
  255. .. rst-class:: classref-property-setget
  256. - |void| **set_tile_set**\ (\ value\: :ref:`TileSet<class_TileSet>`\ )
  257. - :ref:`TileSet<class_TileSet>` **get_tile_set**\ (\ )
  258. The :ref:`TileSet<class_TileSet>` used by this layer. The textures, collisions, and additional behavior of all available tiles are stored here.
  259. .. rst-class:: classref-item-separator
  260. ----
  261. .. _class_TileMapLayer_property_use_kinematic_bodies:
  262. .. rst-class:: classref-property
  263. :ref:`bool<class_bool>` **use_kinematic_bodies** = ``false`` :ref:`🔗<class_TileMapLayer_property_use_kinematic_bodies>`
  264. .. rst-class:: classref-property-setget
  265. - |void| **set_use_kinematic_bodies**\ (\ value\: :ref:`bool<class_bool>`\ )
  266. - :ref:`bool<class_bool>` **is_using_kinematic_bodies**\ (\ )
  267. If ``true``, this **TileMapLayer** collision shapes will be instantiated as kinematic bodies. This can be needed for moving **TileMapLayer** nodes (i.e. moving platforms).
  268. .. rst-class:: classref-item-separator
  269. ----
  270. .. _class_TileMapLayer_property_x_draw_order_reversed:
  271. .. rst-class:: classref-property
  272. :ref:`bool<class_bool>` **x_draw_order_reversed** = ``false`` :ref:`🔗<class_TileMapLayer_property_x_draw_order_reversed>`
  273. .. rst-class:: classref-property-setget
  274. - |void| **set_x_draw_order_reversed**\ (\ value\: :ref:`bool<class_bool>`\ )
  275. - :ref:`bool<class_bool>` **is_x_draw_order_reversed**\ (\ )
  276. If :ref:`CanvasItem.y_sort_enabled<class_CanvasItem_property_y_sort_enabled>` is enabled, setting this to ``true`` will reverse the order the tiles are drawn on the X-axis.
  277. .. rst-class:: classref-item-separator
  278. ----
  279. .. _class_TileMapLayer_property_y_sort_origin:
  280. .. rst-class:: classref-property
  281. :ref:`int<class_int>` **y_sort_origin** = ``0`` :ref:`🔗<class_TileMapLayer_property_y_sort_origin>`
  282. .. rst-class:: classref-property-setget
  283. - |void| **set_y_sort_origin**\ (\ value\: :ref:`int<class_int>`\ )
  284. - :ref:`int<class_int>` **get_y_sort_origin**\ (\ )
  285. 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. This can be useful for top-down view games.
  286. .. rst-class:: classref-section-separator
  287. ----
  288. .. rst-class:: classref-descriptions-group
  289. Method Descriptions
  290. -------------------
  291. .. _class_TileMapLayer_private_method__tile_data_runtime_update:
  292. .. rst-class:: classref-method
  293. |void| **_tile_data_runtime_update**\ (\ coords\: :ref:`Vector2i<class_Vector2i>`, tile_data\: :ref:`TileData<class_TileData>`\ ) |virtual| :ref:`🔗<class_TileMapLayer_private_method__tile_data_runtime_update>`
  294. Called with a :ref:`TileData<class_TileData>` object about to be used internally by the **TileMapLayer**, allowing its modification at runtime.
  295. This method is only called if :ref:`_use_tile_data_runtime_update()<class_TileMapLayer_private_method__use_tile_data_runtime_update>` is implemented and returns ``true`` for the given tile ``coords``.
  296. \ **Warning:** The ``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.
  297. \ **Note:** If the properties of ``tile_data`` object should change over time, use :ref:`notify_runtime_tile_data_update()<class_TileMapLayer_method_notify_runtime_tile_data_update>` to notify the **TileMapLayer** it needs an update.
  298. .. rst-class:: classref-item-separator
  299. ----
  300. .. _class_TileMapLayer_private_method__update_cells:
  301. .. rst-class:: classref-method
  302. |void| **_update_cells**\ (\ coords\: :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\], forced_cleanup\: :ref:`bool<class_bool>`\ ) |virtual| :ref:`🔗<class_TileMapLayer_private_method__update_cells>`
  303. Called when this **TileMapLayer**'s cells need an internal update. This update may be caused from individual cells being modified or by a change in the :ref:`tile_set<class_TileMapLayer_property_tile_set>` (causing all cells to be queued for an update). The first call to this function is always for initializing all the **TileMapLayer**'s cells. ``coords`` contains the coordinates of all modified cells, roughly in the order they were modified. ``forced_cleanup`` is ``true`` when the **TileMapLayer**'s internals should be fully cleaned up. This is the case when:
  304. - The layer is disabled;
  305. - The layer is not visible;
  306. - :ref:`tile_set<class_TileMapLayer_property_tile_set>` is set to ``null``;
  307. - The node is removed from the tree;
  308. - The node is freed.
  309. Note that any internal update happening while one of these conditions is verified is considered to be a "cleanup". See also :ref:`update_internals()<class_TileMapLayer_method_update_internals>`.
  310. \ **Warning:** Implementing this method may degrade the **TileMapLayer**'s performance.
  311. .. rst-class:: classref-item-separator
  312. ----
  313. .. _class_TileMapLayer_private_method__use_tile_data_runtime_update:
  314. .. rst-class:: classref-method
  315. :ref:`bool<class_bool>` **_use_tile_data_runtime_update**\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |virtual| :ref:`🔗<class_TileMapLayer_private_method__use_tile_data_runtime_update>`
  316. Should return ``true`` if the tile at coordinates ``coords`` requires a runtime update.
  317. \ **Warning:** Make sure this function only returns ``true`` when needed. Any tile processed at runtime without a need for it will imply a significant performance penalty.
  318. \ **Note:** If the result of this function should change, use :ref:`notify_runtime_tile_data_update()<class_TileMapLayer_method_notify_runtime_tile_data_update>` to notify the **TileMapLayer** it needs an update.
  319. .. rst-class:: classref-item-separator
  320. ----
  321. .. _class_TileMapLayer_method_clear:
  322. .. rst-class:: classref-method
  323. |void| **clear**\ (\ ) :ref:`🔗<class_TileMapLayer_method_clear>`
  324. Clears all cells.
  325. .. rst-class:: classref-item-separator
  326. ----
  327. .. _class_TileMapLayer_method_erase_cell:
  328. .. rst-class:: classref-method
  329. |void| **erase_cell**\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) :ref:`🔗<class_TileMapLayer_method_erase_cell>`
  330. Erases the cell at coordinates ``coords``.
  331. .. rst-class:: classref-item-separator
  332. ----
  333. .. _class_TileMapLayer_method_fix_invalid_tiles:
  334. .. rst-class:: classref-method
  335. |void| **fix_invalid_tiles**\ (\ ) :ref:`🔗<class_TileMapLayer_method_fix_invalid_tiles>`
  336. Clears cells containing tiles that do not exist in the :ref:`tile_set<class_TileMapLayer_property_tile_set>`.
  337. .. rst-class:: classref-item-separator
  338. ----
  339. .. _class_TileMapLayer_method_get_cell_alternative_tile:
  340. .. rst-class:: classref-method
  341. :ref:`int<class_int>` **get_cell_alternative_tile**\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |const| :ref:`🔗<class_TileMapLayer_method_get_cell_alternative_tile>`
  342. Returns the tile alternative ID of the cell at coordinates ``coords``.
  343. .. rst-class:: classref-item-separator
  344. ----
  345. .. _class_TileMapLayer_method_get_cell_atlas_coords:
  346. .. rst-class:: classref-method
  347. :ref:`Vector2i<class_Vector2i>` **get_cell_atlas_coords**\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |const| :ref:`🔗<class_TileMapLayer_method_get_cell_atlas_coords>`
  348. Returns the tile atlas coordinates ID of the cell at coordinates ``coords``. Returns ``Vector2i(-1, -1)`` if the cell does not exist.
  349. .. rst-class:: classref-item-separator
  350. ----
  351. .. _class_TileMapLayer_method_get_cell_source_id:
  352. .. rst-class:: classref-method
  353. :ref:`int<class_int>` **get_cell_source_id**\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |const| :ref:`🔗<class_TileMapLayer_method_get_cell_source_id>`
  354. Returns the tile source ID of the cell at coordinates ``coords``. Returns ``-1`` if the cell does not exist.
  355. .. rst-class:: classref-item-separator
  356. ----
  357. .. _class_TileMapLayer_method_get_cell_tile_data:
  358. .. rst-class:: classref-method
  359. :ref:`TileData<class_TileData>` **get_cell_tile_data**\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |const| :ref:`🔗<class_TileMapLayer_method_get_cell_tile_data>`
  360. Returns the :ref:`TileData<class_TileData>` object associated with the given cell, or ``null`` if the cell does not exist or is not a :ref:`TileSetAtlasSource<class_TileSetAtlasSource>`.
  361. ::
  362. func get_clicked_tile_power():
  363. var clicked_cell = tile_map_layer.local_to_map(tile_map_layer.get_local_mouse_position())
  364. var data = tile_map_layer.get_cell_tile_data(clicked_cell)
  365. if data:
  366. return data.get_custom_data("power")
  367. else:
  368. return 0
  369. .. rst-class:: classref-item-separator
  370. ----
  371. .. _class_TileMapLayer_method_get_coords_for_body_rid:
  372. .. rst-class:: classref-method
  373. :ref:`Vector2i<class_Vector2i>` **get_coords_for_body_rid**\ (\ body\: :ref:`RID<class_RID>`\ ) |const| :ref:`🔗<class_TileMapLayer_method_get_coords_for_body_rid>`
  374. Returns the coordinates of the physics quadrant (see :ref:`physics_quadrant_size<class_TileMapLayer_property_physics_quadrant_size>`) for given physics body :ref:`RID<class_RID>`. Such an :ref:`RID<class_RID>` can be retrieved from :ref:`KinematicCollision2D.get_collider_rid()<class_KinematicCollision2D_method_get_collider_rid>`, when colliding with a tile.
  375. .. rst-class:: classref-item-separator
  376. ----
  377. .. _class_TileMapLayer_method_get_navigation_map:
  378. .. rst-class:: classref-method
  379. :ref:`RID<class_RID>` **get_navigation_map**\ (\ ) |const| :ref:`🔗<class_TileMapLayer_method_get_navigation_map>`
  380. Returns the :ref:`RID<class_RID>` of the :ref:`NavigationServer2D<class_NavigationServer2D>` navigation used by this **TileMapLayer**.
  381. By default this returns the default :ref:`World2D<class_World2D>` navigation map, unless a custom map was provided using :ref:`set_navigation_map()<class_TileMapLayer_method_set_navigation_map>`.
  382. .. rst-class:: classref-item-separator
  383. ----
  384. .. _class_TileMapLayer_method_get_neighbor_cell:
  385. .. rst-class:: classref-method
  386. :ref:`Vector2i<class_Vector2i>` **get_neighbor_cell**\ (\ coords\: :ref:`Vector2i<class_Vector2i>`, neighbor\: :ref:`CellNeighbor<enum_TileSet_CellNeighbor>`\ ) |const| :ref:`🔗<class_TileMapLayer_method_get_neighbor_cell>`
  387. Returns the neighboring cell to the one at coordinates ``coords``, identified by the ``neighbor`` direction. This method takes into account the different layouts a TileMap can take.
  388. .. rst-class:: classref-item-separator
  389. ----
  390. .. _class_TileMapLayer_method_get_pattern:
  391. .. rst-class:: classref-method
  392. :ref:`TileMapPattern<class_TileMapPattern>` **get_pattern**\ (\ coords_array\: :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\]\ ) :ref:`🔗<class_TileMapLayer_method_get_pattern>`
  393. Creates and returns a new :ref:`TileMapPattern<class_TileMapPattern>` from the given array of cells. See also :ref:`set_pattern()<class_TileMapLayer_method_set_pattern>`.
  394. .. rst-class:: classref-item-separator
  395. ----
  396. .. _class_TileMapLayer_method_get_surrounding_cells:
  397. .. rst-class:: classref-method
  398. :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\] **get_surrounding_cells**\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) :ref:`🔗<class_TileMapLayer_method_get_surrounding_cells>`
  399. Returns the list of all neighboring cells to the one at ``coords``. Any neighboring cell is one that is touching edges, so for a square cell 4 cells would be returned, for a hexagon 6 cells are returned.
  400. .. rst-class:: classref-item-separator
  401. ----
  402. .. _class_TileMapLayer_method_get_used_cells:
  403. .. rst-class:: classref-method
  404. :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\] **get_used_cells**\ (\ ) |const| :ref:`🔗<class_TileMapLayer_method_get_used_cells>`
  405. Returns a :ref:`Vector2i<class_Vector2i>` array with the positions of all cells containing a tile. A cell is considered empty if its source identifier equals ``-1``, its atlas coordinate identifier is ``Vector2(-1, -1)`` and its alternative identifier is ``-1``.
  406. .. rst-class:: classref-item-separator
  407. ----
  408. .. _class_TileMapLayer_method_get_used_cells_by_id:
  409. .. rst-class:: classref-method
  410. :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\] **get_used_cells_by_id**\ (\ source_id\: :ref:`int<class_int>` = -1, atlas_coords\: :ref:`Vector2i<class_Vector2i>` = Vector2i(-1, -1), alternative_tile\: :ref:`int<class_int>` = -1\ ) |const| :ref:`🔗<class_TileMapLayer_method_get_used_cells_by_id>`
  411. Returns a :ref:`Vector2i<class_Vector2i>` array with the positions of all cells containing a tile. Tiles may be filtered according to their source (``source_id``), their atlas coordinates (``atlas_coords``), or alternative id (``alternative_tile``).
  412. 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 values, this method returns the same result as :ref:`get_used_cells()<class_TileMapLayer_method_get_used_cells>`.
  413. A cell is considered empty if its source identifier equals ``-1``, its atlas coordinate identifier is ``Vector2(-1, -1)`` and its alternative identifier is ``-1``.
  414. .. rst-class:: classref-item-separator
  415. ----
  416. .. _class_TileMapLayer_method_get_used_rect:
  417. .. rst-class:: classref-method
  418. :ref:`Rect2i<class_Rect2i>` **get_used_rect**\ (\ ) |const| :ref:`🔗<class_TileMapLayer_method_get_used_rect>`
  419. Returns a rectangle enclosing the used (non-empty) tiles of the map.
  420. .. rst-class:: classref-item-separator
  421. ----
  422. .. _class_TileMapLayer_method_has_body_rid:
  423. .. rst-class:: classref-method
  424. :ref:`bool<class_bool>` **has_body_rid**\ (\ body\: :ref:`RID<class_RID>`\ ) |const| :ref:`🔗<class_TileMapLayer_method_has_body_rid>`
  425. Returns whether the provided ``body`` :ref:`RID<class_RID>` belongs to one of this **TileMapLayer**'s cells.
  426. .. rst-class:: classref-item-separator
  427. ----
  428. .. _class_TileMapLayer_method_is_cell_flipped_h:
  429. .. rst-class:: classref-method
  430. :ref:`bool<class_bool>` **is_cell_flipped_h**\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |const| :ref:`🔗<class_TileMapLayer_method_is_cell_flipped_h>`
  431. Returns ``true`` if the cell at coordinates ``coords`` is flipped horizontally. The result is valid only for atlas sources.
  432. .. rst-class:: classref-item-separator
  433. ----
  434. .. _class_TileMapLayer_method_is_cell_flipped_v:
  435. .. rst-class:: classref-method
  436. :ref:`bool<class_bool>` **is_cell_flipped_v**\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |const| :ref:`🔗<class_TileMapLayer_method_is_cell_flipped_v>`
  437. Returns ``true`` if the cell at coordinates ``coords`` is flipped vertically. The result is valid only for atlas sources.
  438. .. rst-class:: classref-item-separator
  439. ----
  440. .. _class_TileMapLayer_method_is_cell_transposed:
  441. .. rst-class:: classref-method
  442. :ref:`bool<class_bool>` **is_cell_transposed**\ (\ coords\: :ref:`Vector2i<class_Vector2i>`\ ) |const| :ref:`🔗<class_TileMapLayer_method_is_cell_transposed>`
  443. Returns ``true`` if the cell at coordinates ``coords`` is transposed. The result is valid only for atlas sources.
  444. .. rst-class:: classref-item-separator
  445. ----
  446. .. _class_TileMapLayer_method_local_to_map:
  447. .. rst-class:: classref-method
  448. :ref:`Vector2i<class_Vector2i>` **local_to_map**\ (\ local_position\: :ref:`Vector2<class_Vector2>`\ ) |const| :ref:`🔗<class_TileMapLayer_method_local_to_map>`
  449. Returns the map coordinates of the cell containing the given ``local_position``. If ``local_position`` is in global coordinates, consider using :ref:`Node2D.to_local()<class_Node2D_method_to_local>` before passing it to this method. See also :ref:`map_to_local()<class_TileMapLayer_method_map_to_local>`.
  450. .. rst-class:: classref-item-separator
  451. ----
  452. .. _class_TileMapLayer_method_map_pattern:
  453. .. rst-class:: classref-method
  454. :ref:`Vector2i<class_Vector2i>` **map_pattern**\ (\ position_in_tilemap\: :ref:`Vector2i<class_Vector2i>`, coords_in_pattern\: :ref:`Vector2i<class_Vector2i>`, pattern\: :ref:`TileMapPattern<class_TileMapPattern>`\ ) :ref:`🔗<class_TileMapLayer_method_map_pattern>`
  455. Returns for the given coordinates ``coords_in_pattern`` in a :ref:`TileMapPattern<class_TileMapPattern>` the corresponding cell coordinates if the pattern was pasted at the ``position_in_tilemap`` coordinates (see :ref:`set_pattern()<class_TileMapLayer_method_set_pattern>`). This mapping is required as in half-offset tile shapes, the mapping might not work by calculating ``position_in_tile_map + coords_in_pattern``.
  456. .. rst-class:: classref-item-separator
  457. ----
  458. .. _class_TileMapLayer_method_map_to_local:
  459. .. rst-class:: classref-method
  460. :ref:`Vector2<class_Vector2>` **map_to_local**\ (\ map_position\: :ref:`Vector2i<class_Vector2i>`\ ) |const| :ref:`🔗<class_TileMapLayer_method_map_to_local>`
  461. Returns the centered position of a cell in the **TileMapLayer**'s local coordinate space. To convert the returned value into global coordinates, use :ref:`Node2D.to_global()<class_Node2D_method_to_global>`. See also :ref:`local_to_map()<class_TileMapLayer_method_local_to_map>`.
  462. \ **Note:** This may not correspond to the visual position of the tile, i.e. it ignores the :ref:`TileData.texture_origin<class_TileData_property_texture_origin>` property of individual tiles.
  463. .. rst-class:: classref-item-separator
  464. ----
  465. .. _class_TileMapLayer_method_notify_runtime_tile_data_update:
  466. .. rst-class:: classref-method
  467. |void| **notify_runtime_tile_data_update**\ (\ ) :ref:`🔗<class_TileMapLayer_method_notify_runtime_tile_data_update>`
  468. Notifies the **TileMapLayer** node that calls to :ref:`_use_tile_data_runtime_update()<class_TileMapLayer_private_method__use_tile_data_runtime_update>` or :ref:`_tile_data_runtime_update()<class_TileMapLayer_private_method__tile_data_runtime_update>` will lead to different results. This will thus trigger a **TileMapLayer** update.
  469. \ **Warning:** Updating the **TileMapLayer** is computationally expensive and may impact performance. Try to limit the number of calls to this function to avoid unnecessary update.
  470. \ **Note:** This does not trigger a direct update of the **TileMapLayer**, the update will be done at the end of the frame as usual (unless you call :ref:`update_internals()<class_TileMapLayer_method_update_internals>`).
  471. .. rst-class:: classref-item-separator
  472. ----
  473. .. _class_TileMapLayer_method_set_cell:
  474. .. rst-class:: classref-method
  475. |void| **set_cell**\ (\ coords\: :ref:`Vector2i<class_Vector2i>`, source_id\: :ref:`int<class_int>` = -1, atlas_coords\: :ref:`Vector2i<class_Vector2i>` = Vector2i(-1, -1), alternative_tile\: :ref:`int<class_int>` = 0\ ) :ref:`🔗<class_TileMapLayer_method_set_cell>`
  476. Sets the tile identifiers for the cell at coordinates ``coords``. Each tile of the :ref:`TileSet<class_TileSet>` is identified using three parts:
  477. - The source identifier ``source_id`` identifies a :ref:`TileSetSource<class_TileSetSource>` identifier. See :ref:`TileSet.set_source_id()<class_TileSet_method_set_source_id>`,
  478. - The atlas coordinate identifier ``atlas_coords`` identifies a tile coordinates in the atlas (if the source is a :ref:`TileSetAtlasSource<class_TileSetAtlasSource>`). For :ref:`TileSetScenesCollectionSource<class_TileSetScenesCollectionSource>` it should always be ``Vector2i(0, 0)``,
  479. - The alternative tile identifier ``alternative_tile`` identifies a tile alternative in the atlas (if the source is a :ref:`TileSetAtlasSource<class_TileSetAtlasSource>`), and the scene for a :ref:`TileSetScenesCollectionSource<class_TileSetScenesCollectionSource>`.
  480. If ``source_id`` is set to ``-1``, ``atlas_coords`` to ``Vector2i(-1, -1)``, or ``alternative_tile`` to ``-1``, the cell will be erased. An erased cell gets **all** its identifiers automatically set to their respective invalid values, namely ``-1``, ``Vector2i(-1, -1)`` and ``-1``.
  481. .. rst-class:: classref-item-separator
  482. ----
  483. .. _class_TileMapLayer_method_set_cells_terrain_connect:
  484. .. rst-class:: classref-method
  485. |void| **set_cells_terrain_connect**\ (\ cells\: :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\], terrain_set\: :ref:`int<class_int>`, terrain\: :ref:`int<class_int>`, ignore_empty_terrains\: :ref:`bool<class_bool>` = true\ ) :ref:`🔗<class_TileMapLayer_method_set_cells_terrain_connect>`
  486. Update all the cells in the ``cells`` coordinates array so that they use the given ``terrain`` for the given ``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.
  487. If ``ignore_empty_terrains`` is ``true``, empty terrains will be ignored when trying to find the best fitting tile for the given terrain constraints.
  488. \ **Note:** To work correctly, this method requires the **TileMapLayer**'s TileSet to have terrains set up with all required terrain combinations. Otherwise, it may produce unexpected results.
  489. .. rst-class:: classref-item-separator
  490. ----
  491. .. _class_TileMapLayer_method_set_cells_terrain_path:
  492. .. rst-class:: classref-method
  493. |void| **set_cells_terrain_path**\ (\ path\: :ref:`Array<class_Array>`\[:ref:`Vector2i<class_Vector2i>`\], terrain_set\: :ref:`int<class_int>`, terrain\: :ref:`int<class_int>`, ignore_empty_terrains\: :ref:`bool<class_bool>` = true\ ) :ref:`🔗<class_TileMapLayer_method_set_cells_terrain_path>`
  494. Update all the cells in the ``path`` coordinates array so that they use the given ``terrain`` for the given ``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.
  495. If ``ignore_empty_terrains`` is ``true``, empty terrains will be ignored when trying to find the best fitting tile for the given terrain constraints.
  496. \ **Note:** To work correctly, this method requires the **TileMapLayer**'s TileSet to have terrains set up with all required terrain combinations. Otherwise, it may produce unexpected results.
  497. .. rst-class:: classref-item-separator
  498. ----
  499. .. _class_TileMapLayer_method_set_navigation_map:
  500. .. rst-class:: classref-method
  501. |void| **set_navigation_map**\ (\ map\: :ref:`RID<class_RID>`\ ) :ref:`🔗<class_TileMapLayer_method_set_navigation_map>`
  502. Sets a custom ``map`` as a :ref:`NavigationServer2D<class_NavigationServer2D>` navigation map. If not set, uses the default :ref:`World2D<class_World2D>` navigation map instead.
  503. .. rst-class:: classref-item-separator
  504. ----
  505. .. _class_TileMapLayer_method_set_pattern:
  506. .. rst-class:: classref-method
  507. |void| **set_pattern**\ (\ position\: :ref:`Vector2i<class_Vector2i>`, pattern\: :ref:`TileMapPattern<class_TileMapPattern>`\ ) :ref:`🔗<class_TileMapLayer_method_set_pattern>`
  508. Pastes the :ref:`TileMapPattern<class_TileMapPattern>` at the given ``position`` in the tile map. See also :ref:`get_pattern()<class_TileMapLayer_method_get_pattern>`.
  509. .. rst-class:: classref-item-separator
  510. ----
  511. .. _class_TileMapLayer_method_update_internals:
  512. .. rst-class:: classref-method
  513. |void| **update_internals**\ (\ ) :ref:`🔗<class_TileMapLayer_method_update_internals>`
  514. Triggers a direct update of the **TileMapLayer**. Usually, calling this function is not needed, as **TileMapLayer** node updates automatically when one of its properties or cells is modified.
  515. However, for performance reasons, those updates are batched and delayed to the end of the frame. Calling this function will force the **TileMapLayer** to update right away instead.
  516. \ **Warning:** Updating the **TileMapLayer** is computationally expensive and may impact performance. Try to limit the number of updates and how many tiles they impact.
  517. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  518. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  519. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  520. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  521. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  522. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  523. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  524. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  525. .. |void| replace:: :abbr:`void (No return value.)`