class_tilesetatlassource.rst 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the TileSetAtlasSource.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_TileSetAtlasSource:
  6. TileSetAtlasSource
  7. ==================
  8. **Inherits:** :ref:`TileSetSource<class_TileSetSource>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  9. Exposes a 2D atlas texture as a set of tiles for a :ref:`TileSet<class_TileSet>` resource.
  10. Description
  11. -----------
  12. An atlas is a grid of tiles laid out on a texture. Each tile in the grid must be exposed using :ref:`create_tile<class_TileSetAtlasSource_method_create_tile>`. Those tiles are then indexed using their coordinates in the grid.
  13. Each tile can also have a size in the grid coordinates, making it more or less cells in the atlas.
  14. Alternatives version of a tile can be created using :ref:`create_alternative_tile<class_TileSetAtlasSource_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.
  15. Each tile alternate has a set of properties that is defined by the source's :ref:`TileSet<class_TileSet>` layers. Those properties are stored in a TileData object that can be accessed and modified using :ref:`get_tile_data<class_TileSetAtlasSource_method_get_tile_data>`.
  16. As TileData properties are stored directly in the TileSetAtlasSource resource, their properties might also be set using ``TileSetAtlasSource.set("<coords_x>:<coords_y>/<alternative_id>/<tile_data_property>")``.
  17. Properties
  18. ----------
  19. +-----------------------------------+-----------------------------------------------------------------------------------+----------------------+
  20. | :ref:`Vector2i<class_Vector2i>` | :ref:`margins<class_TileSetAtlasSource_property_margins>` | ``Vector2i(0, 0)`` |
  21. +-----------------------------------+-----------------------------------------------------------------------------------+----------------------+
  22. | :ref:`Vector2i<class_Vector2i>` | :ref:`separation<class_TileSetAtlasSource_property_separation>` | ``Vector2i(0, 0)`` |
  23. +-----------------------------------+-----------------------------------------------------------------------------------+----------------------+
  24. | :ref:`Texture2D<class_Texture2D>` | :ref:`texture<class_TileSetAtlasSource_property_texture>` | |
  25. +-----------------------------------+-----------------------------------------------------------------------------------+----------------------+
  26. | :ref:`Vector2i<class_Vector2i>` | :ref:`texture_region_size<class_TileSetAtlasSource_property_texture_region_size>` | ``Vector2i(16, 16)`` |
  27. +-----------------------------------+-----------------------------------------------------------------------------------+----------------------+
  28. | :ref:`bool<class_bool>` | :ref:`use_texture_padding<class_TileSetAtlasSource_property_use_texture_padding>` | ``true`` |
  29. +-----------------------------------+-----------------------------------------------------------------------------------+----------------------+
  30. Methods
  31. -------
  32. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`int<class_int>` | :ref:`create_alternative_tile<class_TileSetAtlasSource_method_create_alternative_tile>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` alternative_id_override=-1 **)** |
  34. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`create_tile<class_TileSetAtlasSource_method_create_tile>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`Vector2i<class_Vector2i>` size=Vector2i(1, 1) **)** |
  36. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`Vector2i<class_Vector2i>` | :ref:`get_atlas_grid_size<class_TileSetAtlasSource_method_get_atlas_grid_size>` **(** **)** |const| |
  38. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`int<class_int>` | :ref:`get_next_alternative_tile_id<class_TileSetAtlasSource_method_get_next_alternative_tile_id>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const| |
  40. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Texture2D<class_Texture2D>` | :ref:`get_runtime_texture<class_TileSetAtlasSource_method_get_runtime_texture>` **(** **)** |const| |
  42. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`Rect2i<class_Rect2i>` | :ref:`get_runtime_tile_texture_region<class_TileSetAtlasSource_method_get_runtime_tile_texture_region>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` frame **)** |const| |
  44. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`int<class_int>` | :ref:`get_tile_animation_columns<class_TileSetAtlasSource_method_get_tile_animation_columns>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const| |
  46. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`float<class_float>` | :ref:`get_tile_animation_frame_duration<class_TileSetAtlasSource_method_get_tile_animation_frame_duration>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` frame_index **)** |const| |
  48. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`int<class_int>` | :ref:`get_tile_animation_frames_count<class_TileSetAtlasSource_method_get_tile_animation_frames_count>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const| |
  50. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`Vector2i<class_Vector2i>` | :ref:`get_tile_animation_separation<class_TileSetAtlasSource_method_get_tile_animation_separation>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const| |
  52. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`float<class_float>` | :ref:`get_tile_animation_speed<class_TileSetAtlasSource_method_get_tile_animation_speed>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const| |
  54. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`float<class_float>` | :ref:`get_tile_animation_total_duration<class_TileSetAtlasSource_method_get_tile_animation_total_duration>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const| |
  56. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`Vector2i<class_Vector2i>` | :ref:`get_tile_at_coords<class_TileSetAtlasSource_method_get_tile_at_coords>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const| |
  58. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`TileData<class_TileData>` | :ref:`get_tile_data<class_TileSetAtlasSource_method_get_tile_data>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` alternative_tile **)** |const| |
  60. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`Vector2i<class_Vector2i>` | :ref:`get_tile_size_in_atlas<class_TileSetAtlasSource_method_get_tile_size_in_atlas>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const| |
  62. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`Rect2i<class_Rect2i>` | :ref:`get_tile_texture_region<class_TileSetAtlasSource_method_get_tile_texture_region>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` frame=0 **)** |const| |
  64. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`get_tiles_to_be_removed_on_change<class_TileSetAtlasSource_method_get_tiles_to_be_removed_on_change>` **(** :ref:`Texture2D<class_Texture2D>` texture, :ref:`Vector2i<class_Vector2i>` margins, :ref:`Vector2i<class_Vector2i>` separation, :ref:`Vector2i<class_Vector2i>` texture_region_size **)** |
  66. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`bool<class_bool>` | :ref:`has_room_for_tile<class_TileSetAtlasSource_method_has_room_for_tile>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`Vector2i<class_Vector2i>` size, :ref:`int<class_int>` animation_columns, :ref:`Vector2i<class_Vector2i>` animation_separation, :ref:`int<class_int>` frames_count, :ref:`Vector2i<class_Vector2i>` ignored_tile=Vector2i(-1, -1) **)** |const| |
  68. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | void | :ref:`move_tile_in_atlas<class_TileSetAtlasSource_method_move_tile_in_atlas>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`Vector2i<class_Vector2i>` new_atlas_coords=Vector2i(-1, -1), :ref:`Vector2i<class_Vector2i>` new_size=Vector2i(-1, -1) **)** |
  70. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | void | :ref:`remove_alternative_tile<class_TileSetAtlasSource_method_remove_alternative_tile>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` alternative_tile **)** |
  72. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | void | :ref:`remove_tile<class_TileSetAtlasSource_method_remove_tile>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |
  74. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | void | :ref:`set_alternative_tile_id<class_TileSetAtlasSource_method_set_alternative_tile_id>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` alternative_tile, :ref:`int<class_int>` new_id **)** |
  76. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | void | :ref:`set_tile_animation_columns<class_TileSetAtlasSource_method_set_tile_animation_columns>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` frame_columns **)** |
  78. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | void | :ref:`set_tile_animation_frame_duration<class_TileSetAtlasSource_method_set_tile_animation_frame_duration>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` frame_index, :ref:`float<class_float>` duration **)** |
  80. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | void | :ref:`set_tile_animation_frames_count<class_TileSetAtlasSource_method_set_tile_animation_frames_count>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` frames_count **)** |
  82. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | void | :ref:`set_tile_animation_separation<class_TileSetAtlasSource_method_set_tile_animation_separation>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`Vector2i<class_Vector2i>` separation **)** |
  84. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | void | :ref:`set_tile_animation_speed<class_TileSetAtlasSource_method_set_tile_animation_speed>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`float<class_float>` speed **)** |
  86. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. Property Descriptions
  88. ---------------------
  89. .. _class_TileSetAtlasSource_property_margins:
  90. - :ref:`Vector2i<class_Vector2i>` **margins**
  91. +-----------+--------------------+
  92. | *Default* | ``Vector2i(0, 0)`` |
  93. +-----------+--------------------+
  94. | *Setter* | set_margins(value) |
  95. +-----------+--------------------+
  96. | *Getter* | get_margins() |
  97. +-----------+--------------------+
  98. Margins, in pixels, to offset the origin of the grid in the texture.
  99. ----
  100. .. _class_TileSetAtlasSource_property_separation:
  101. - :ref:`Vector2i<class_Vector2i>` **separation**
  102. +-----------+-----------------------+
  103. | *Default* | ``Vector2i(0, 0)`` |
  104. +-----------+-----------------------+
  105. | *Setter* | set_separation(value) |
  106. +-----------+-----------------------+
  107. | *Getter* | get_separation() |
  108. +-----------+-----------------------+
  109. Separation, in pixels, between each tile texture region of the grid.
  110. ----
  111. .. _class_TileSetAtlasSource_property_texture:
  112. - :ref:`Texture2D<class_Texture2D>` **texture**
  113. +----------+--------------------+
  114. | *Setter* | set_texture(value) |
  115. +----------+--------------------+
  116. | *Getter* | get_texture() |
  117. +----------+--------------------+
  118. The atlas texture.
  119. ----
  120. .. _class_TileSetAtlasSource_property_texture_region_size:
  121. - :ref:`Vector2i<class_Vector2i>` **texture_region_size**
  122. +-----------+--------------------------------+
  123. | *Default* | ``Vector2i(16, 16)`` |
  124. +-----------+--------------------------------+
  125. | *Setter* | set_texture_region_size(value) |
  126. +-----------+--------------------------------+
  127. | *Getter* | get_texture_region_size() |
  128. +-----------+--------------------------------+
  129. The base tile size in the texture (in pixel). This size must be bigger than the TileSet's ``tile_size`` value.
  130. ----
  131. .. _class_TileSetAtlasSource_property_use_texture_padding:
  132. - :ref:`bool<class_bool>` **use_texture_padding**
  133. +-----------+--------------------------------+
  134. | *Default* | ``true`` |
  135. +-----------+--------------------------------+
  136. | *Setter* | set_use_texture_padding(value) |
  137. +-----------+--------------------------------+
  138. | *Getter* | get_use_texture_padding() |
  139. +-----------+--------------------------------+
  140. If ``true``, generates an internal texture with an additional one pixel padding around each tile. Texture padding avoids a common artifact where lines appear between tiles.
  141. 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.
  142. Method Descriptions
  143. -------------------
  144. .. _class_TileSetAtlasSource_method_create_alternative_tile:
  145. - :ref:`int<class_int>` **create_alternative_tile** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` alternative_id_override=-1 **)**
  146. Creates an alternative tile for the tile at coords ``atlas_coords``. If ``alternative_id_override`` is -1, give it an automatically generated unique ID, or assigns it the given ID otherwise.
  147. Returns the new alternative identifier, or -1 if the alternative could not be created with a provided ``alternative_id_override``.
  148. ----
  149. .. _class_TileSetAtlasSource_method_create_tile:
  150. - void **create_tile** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`Vector2i<class_Vector2i>` size=Vector2i(1, 1) **)**
  151. Creates a new tile at coords ``atlas_coords`` with size ``size``.
  152. ----
  153. .. _class_TileSetAtlasSource_method_get_atlas_grid_size:
  154. - :ref:`Vector2i<class_Vector2i>` **get_atlas_grid_size** **(** **)** |const|
  155. Returns the atlas grid size, which depends on how many tiles can fit in the texture. It thus depends on the Texture's size, the atlas ``margins`` the tiles' ``texture_region_size``.
  156. ----
  157. .. _class_TileSetAtlasSource_method_get_next_alternative_tile_id:
  158. - :ref:`int<class_int>` **get_next_alternative_tile_id** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const|
  159. Returns the alternative ID a following call to :ref:`create_alternative_tile<class_TileSetAtlasSource_method_create_alternative_tile>` would return.
  160. ----
  161. .. _class_TileSetAtlasSource_method_get_runtime_texture:
  162. - :ref:`Texture2D<class_Texture2D>` **get_runtime_texture** **(** **)** |const|
  163. If :ref:`use_texture_padding<class_TileSetAtlasSource_property_use_texture_padding>` is ``false``, returns :ref:`texture<class_TileSetAtlasSource_property_texture>`. Otherwise, returns and internal :ref:`ImageTexture<class_ImageTexture>` created that includes the padding.
  164. ----
  165. .. _class_TileSetAtlasSource_method_get_runtime_tile_texture_region:
  166. - :ref:`Rect2i<class_Rect2i>` **get_runtime_tile_texture_region** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` frame **)** |const|
  167. Returns the region of the tile at coordinates ``atlas_coords`` for frame ``frame`` inside the texture returned by :ref:`get_runtime_texture<class_TileSetAtlasSource_method_get_runtime_texture>`.
  168. \ **Note:** If :ref:`use_texture_padding<class_TileSetAtlasSource_property_use_texture_padding>` is ``false``, returns the same as :ref:`get_tile_texture_region<class_TileSetAtlasSource_method_get_tile_texture_region>`.
  169. ----
  170. .. _class_TileSetAtlasSource_method_get_tile_animation_columns:
  171. - :ref:`int<class_int>` **get_tile_animation_columns** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const|
  172. Returns how many columns the tile at ``atlas_coords`` has in its animation layout.
  173. ----
  174. .. _class_TileSetAtlasSource_method_get_tile_animation_frame_duration:
  175. - :ref:`float<class_float>` **get_tile_animation_frame_duration** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` frame_index **)** |const|
  176. Returns the animation frame duration of frame ``frame_index`` for the tile at coordinates ``atlas_coords``.
  177. ----
  178. .. _class_TileSetAtlasSource_method_get_tile_animation_frames_count:
  179. - :ref:`int<class_int>` **get_tile_animation_frames_count** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const|
  180. Returns how many animation frames has the tile at coordinates ``atlas_coords``.
  181. ----
  182. .. _class_TileSetAtlasSource_method_get_tile_animation_separation:
  183. - :ref:`Vector2i<class_Vector2i>` **get_tile_animation_separation** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const|
  184. Returns the separation (as in the atlas grid) between each frame of an animated tile at coordinates ``atlas_coords``.
  185. ----
  186. .. _class_TileSetAtlasSource_method_get_tile_animation_speed:
  187. - :ref:`float<class_float>` **get_tile_animation_speed** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const|
  188. Returns the animation speed of the tile at coordinates ``atlas_coords``.
  189. ----
  190. .. _class_TileSetAtlasSource_method_get_tile_animation_total_duration:
  191. - :ref:`float<class_float>` **get_tile_animation_total_duration** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const|
  192. Returns the sum of the sum of the frame durations of the tile at coordinates ``atlas_coords``. This value needs to be divided by the animation speed to get the actual animation loop duration.
  193. ----
  194. .. _class_TileSetAtlasSource_method_get_tile_at_coords:
  195. - :ref:`Vector2i<class_Vector2i>` **get_tile_at_coords** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const|
  196. If there is a tile covering the ``atlas_coords`` coordinates, returns the top-left coordinates of the tile (thus its coordinate ID). Returns ``Vector2i(-1, -1)`` otherwise.
  197. ----
  198. .. _class_TileSetAtlasSource_method_get_tile_data:
  199. - :ref:`TileData<class_TileData>` **get_tile_data** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` alternative_tile **)** |const|
  200. Returns the :ref:`TileData<class_TileData>` object for the given atlas coordinates and alternative ID.
  201. ----
  202. .. _class_TileSetAtlasSource_method_get_tile_size_in_atlas:
  203. - :ref:`Vector2i<class_Vector2i>` **get_tile_size_in_atlas** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const|
  204. Returns the size of the tile (in the grid coordinates system) at coordinates ``atlas_coords``.
  205. ----
  206. .. _class_TileSetAtlasSource_method_get_tile_texture_region:
  207. - :ref:`Rect2i<class_Rect2i>` **get_tile_texture_region** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` frame=0 **)** |const|
  208. Returns a tile's texture region in the atlas texture. For animated tiles, a ``frame`` argument might be provided for the different frames of the animation.
  209. ----
  210. .. _class_TileSetAtlasSource_method_get_tiles_to_be_removed_on_change:
  211. - :ref:`PackedVector2Array<class_PackedVector2Array>` **get_tiles_to_be_removed_on_change** **(** :ref:`Texture2D<class_Texture2D>` texture, :ref:`Vector2i<class_Vector2i>` margins, :ref:`Vector2i<class_Vector2i>` separation, :ref:`Vector2i<class_Vector2i>` texture_region_size **)**
  212. Returns an array of tiles coordinates ID that will be automatically removed when modifying one or several of those properties: ``texture``, ``margins``, ``separation`` or ``texture_region_size``. This can be used to undo changes that would have caused tiles data loss.
  213. ----
  214. .. _class_TileSetAtlasSource_method_has_room_for_tile:
  215. - :ref:`bool<class_bool>` **has_room_for_tile** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`Vector2i<class_Vector2i>` size, :ref:`int<class_int>` animation_columns, :ref:`Vector2i<class_Vector2i>` animation_separation, :ref:`int<class_int>` frames_count, :ref:`Vector2i<class_Vector2i>` ignored_tile=Vector2i(-1, -1) **)** |const|
  216. Returns whether there is enough room in an atlas to create/modify a tile with the given properties. If ``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.
  217. ----
  218. .. _class_TileSetAtlasSource_method_move_tile_in_atlas:
  219. - void **move_tile_in_atlas** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`Vector2i<class_Vector2i>` new_atlas_coords=Vector2i(-1, -1), :ref:`Vector2i<class_Vector2i>` new_size=Vector2i(-1, -1) **)**
  220. Move the tile and its alternatives at the ``atlas_coords`` coordinates to the ``new_atlas_coords`` coordinates with the ``new_size`` size. This functions will fail if a tile is already present in the given area.
  221. If ``new_atlas_coords`` is ``Vector2i(-1, -1)``, keeps the tile's coordinates. If ``new_size`` is ``Vector2i(-1, -1)``, keeps the tile's size.
  222. To avoid an error, first check if a move is possible using :ref:`has_room_for_tile<class_TileSetAtlasSource_method_has_room_for_tile>`.
  223. ----
  224. .. _class_TileSetAtlasSource_method_remove_alternative_tile:
  225. - void **remove_alternative_tile** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` alternative_tile **)**
  226. Remove a tile's alternative with alternative ID ``alternative_tile``.
  227. Calling this function with ``alternative_tile`` equals to 0 will fail, as the base tile alternative cannot be removed.
  228. ----
  229. .. _class_TileSetAtlasSource_method_remove_tile:
  230. - void **remove_tile** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)**
  231. Remove a tile and its alternative at coordinates ``atlas_coords``.
  232. ----
  233. .. _class_TileSetAtlasSource_method_set_alternative_tile_id:
  234. - void **set_alternative_tile_id** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` alternative_tile, :ref:`int<class_int>` new_id **)**
  235. Change a tile's alternative ID from ``alternative_tile`` to ``new_id``.
  236. Calling this function with ``alternative_id`` equals to 0 will fail, as the base tile alternative cannot be moved.
  237. ----
  238. .. _class_TileSetAtlasSource_method_set_tile_animation_columns:
  239. - void **set_tile_animation_columns** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` frame_columns **)**
  240. Sets the number of columns in the animation layout of the tile at coordinates ``atlas_coords``. If set to 0, then the different frames of the animation are laid out as a single horizontal line in the atlas.
  241. ----
  242. .. _class_TileSetAtlasSource_method_set_tile_animation_frame_duration:
  243. - void **set_tile_animation_frame_duration** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` frame_index, :ref:`float<class_float>` duration **)**
  244. Sets the animation frame duration of frame ``frame_index`` for the tile at coordinates ``atlas_coords``.
  245. ----
  246. .. _class_TileSetAtlasSource_method_set_tile_animation_frames_count:
  247. - void **set_tile_animation_frames_count** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` frames_count **)**
  248. Sets how many animation frames the tile at coordinates ``atlas_coords`` has.
  249. ----
  250. .. _class_TileSetAtlasSource_method_set_tile_animation_separation:
  251. - void **set_tile_animation_separation** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`Vector2i<class_Vector2i>` separation **)**
  252. Sets the margin (in grid tiles) between each tile in the animation layout of the tile at coordinates ``atlas_coords`` has.
  253. ----
  254. .. _class_TileSetAtlasSource_method_set_tile_animation_speed:
  255. - void **set_tile_animation_speed** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`float<class_float>` speed **)**
  256. Sets the animation speed of the tile at coordinates ``atlas_coords`` has.
  257. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  258. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  259. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  260. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  261. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  262. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`