class_tileset.rst 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_TileSet:
  4. TileSet
  5. =======
  6. **Inherits:** :ref:`Resource<class_resource>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Tile library for tilemaps.
  11. Member Functions
  12. ----------------
  13. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  14. | void | :ref:`clear<class_TileSet_clear>` **(** **)** |
  15. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`create_tile<class_TileSet_create_tile>` **(** :ref:`int<class_int>` id **)** |
  17. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`int<class_int>` | :ref:`find_tile_by_name<class_TileSet_find_tile_by_name>` **(** :ref:`String<class_string>` name **)** const |
  19. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`int<class_int>` | :ref:`get_last_unused_tile_id<class_TileSet_get_last_unused_tile_id>` **(** **)** const |
  21. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`Array<class_array>` | :ref:`get_tiles_ids<class_TileSet_get_tiles_ids>` **(** **)** const |
  23. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`remove_tile<class_TileSet_remove_tile>` **(** :ref:`int<class_int>` id **)** |
  25. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`OccluderPolygon2D<class_occluderpolygon2d>` | :ref:`tile_get_light_occluder<class_TileSet_tile_get_light_occluder>` **(** :ref:`int<class_int>` id **)** const |
  27. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`CanvasItemMaterial<class_canvasitemmaterial>` | :ref:`tile_get_material<class_TileSet_tile_get_material>` **(** :ref:`int<class_int>` id **)** const |
  29. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`String<class_string>` | :ref:`tile_get_name<class_TileSet_tile_get_name>` **(** :ref:`int<class_int>` id **)** const |
  31. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`NavigationPolygon<class_navigationpolygon>` | :ref:`tile_get_navigation_polygon<class_TileSet_tile_get_navigation_polygon>` **(** :ref:`int<class_int>` id **)** const |
  33. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`Vector2<class_vector2>` | :ref:`tile_get_navigation_polygon_offset<class_TileSet_tile_get_navigation_polygon_offset>` **(** :ref:`int<class_int>` id **)** const |
  35. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`Vector2<class_vector2>` | :ref:`tile_get_occluder_offset<class_TileSet_tile_get_occluder_offset>` **(** :ref:`int<class_int>` id **)** const |
  37. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`Rect2<class_rect2>` | :ref:`tile_get_region<class_TileSet_tile_get_region>` **(** :ref:`int<class_int>` id **)** const |
  39. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`Shape2D<class_shape2d>` | :ref:`tile_get_shape<class_TileSet_tile_get_shape>` **(** :ref:`int<class_int>` id **)** const |
  41. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`Vector2<class_vector2>` | :ref:`tile_get_shape_offset<class_TileSet_tile_get_shape_offset>` **(** :ref:`int<class_int>` id **)** const |
  43. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Array<class_array>` | :ref:`tile_get_shapes<class_TileSet_tile_get_shapes>` **(** :ref:`int<class_int>` id **)** const |
  45. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`Texture<class_texture>` | :ref:`tile_get_texture<class_TileSet_tile_get_texture>` **(** :ref:`int<class_int>` id **)** const |
  47. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`Vector2<class_vector2>` | :ref:`tile_get_texture_offset<class_TileSet_tile_get_texture_offset>` **(** :ref:`int<class_int>` id **)** const |
  49. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`tile_set_light_occluder<class_TileSet_tile_set_light_occluder>` **(** :ref:`int<class_int>` id, :ref:`OccluderPolygon2D<class_occluderpolygon2d>` light_occluder **)** |
  51. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`tile_set_material<class_TileSet_tile_set_material>` **(** :ref:`int<class_int>` id, :ref:`CanvasItemMaterial<class_canvasitemmaterial>` material **)** |
  53. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`tile_set_name<class_TileSet_tile_set_name>` **(** :ref:`int<class_int>` id, :ref:`String<class_string>` name **)** |
  55. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`tile_set_navigation_polygon<class_TileSet_tile_set_navigation_polygon>` **(** :ref:`int<class_int>` id, :ref:`NavigationPolygon<class_navigationpolygon>` navigation_polygon **)** |
  57. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`tile_set_navigation_polygon_offset<class_TileSet_tile_set_navigation_polygon_offset>` **(** :ref:`int<class_int>` id, :ref:`Vector2<class_vector2>` navigation_polygon_offset **)** |
  59. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`tile_set_occluder_offset<class_TileSet_tile_set_occluder_offset>` **(** :ref:`int<class_int>` id, :ref:`Vector2<class_vector2>` occluder_offset **)** |
  61. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`tile_set_region<class_TileSet_tile_set_region>` **(** :ref:`int<class_int>` id, :ref:`Rect2<class_rect2>` region **)** |
  63. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | void | :ref:`tile_set_shape<class_TileSet_tile_set_shape>` **(** :ref:`int<class_int>` id, :ref:`Shape2D<class_shape2d>` shape **)** |
  65. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | void | :ref:`tile_set_shape_offset<class_TileSet_tile_set_shape_offset>` **(** :ref:`int<class_int>` id, :ref:`Vector2<class_vector2>` shape_offset **)** |
  67. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | void | :ref:`tile_set_shapes<class_TileSet_tile_set_shapes>` **(** :ref:`int<class_int>` id, :ref:`Array<class_array>` shapes **)** |
  69. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | void | :ref:`tile_set_texture<class_TileSet_tile_set_texture>` **(** :ref:`int<class_int>` id, :ref:`Texture<class_texture>` texture **)** |
  71. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | void | :ref:`tile_set_texture_offset<class_TileSet_tile_set_texture_offset>` **(** :ref:`int<class_int>` id, :ref:`Vector2<class_vector2>` texture_offset **)** |
  73. +------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. Description
  75. -----------
  76. A TileSet is a library of tiles for a :ref:`TileMap<class_tilemap>`. It contains a list of tiles, each consisting of a sprite and optional collision shapes.
  77. Tiles are referenced by a unique integer ID.
  78. Member Function Description
  79. ---------------------------
  80. .. _class_TileSet_clear:
  81. - void **clear** **(** **)**
  82. Clear all tiles.
  83. .. _class_TileSet_create_tile:
  84. - void **create_tile** **(** :ref:`int<class_int>` id **)**
  85. Create a new tile which will be referenced by the given ID.
  86. .. _class_TileSet_find_tile_by_name:
  87. - :ref:`int<class_int>` **find_tile_by_name** **(** :ref:`String<class_string>` name **)** const
  88. Find the first tile matching the given name.
  89. .. _class_TileSet_get_last_unused_tile_id:
  90. - :ref:`int<class_int>` **get_last_unused_tile_id** **(** **)** const
  91. Return the ID following the last currently used ID, useful when creating a new tile.
  92. .. _class_TileSet_get_tiles_ids:
  93. - :ref:`Array<class_array>` **get_tiles_ids** **(** **)** const
  94. Return an array of all currently used tile IDs.
  95. .. _class_TileSet_remove_tile:
  96. - void **remove_tile** **(** :ref:`int<class_int>` id **)**
  97. Remove the tile referenced by the given ID.
  98. .. _class_TileSet_tile_get_light_occluder:
  99. - :ref:`OccluderPolygon2D<class_occluderpolygon2d>` **tile_get_light_occluder** **(** :ref:`int<class_int>` id **)** const
  100. Return the light occluder of the tile.
  101. .. _class_TileSet_tile_get_material:
  102. - :ref:`CanvasItemMaterial<class_canvasitemmaterial>` **tile_get_material** **(** :ref:`int<class_int>` id **)** const
  103. Return the material of the tile.
  104. .. _class_TileSet_tile_get_name:
  105. - :ref:`String<class_string>` **tile_get_name** **(** :ref:`int<class_int>` id **)** const
  106. Return the name of the tile.
  107. .. _class_TileSet_tile_get_navigation_polygon:
  108. - :ref:`NavigationPolygon<class_navigationpolygon>` **tile_get_navigation_polygon** **(** :ref:`int<class_int>` id **)** const
  109. Return the navigation polygon of the tile.
  110. .. _class_TileSet_tile_get_navigation_polygon_offset:
  111. - :ref:`Vector2<class_vector2>` **tile_get_navigation_polygon_offset** **(** :ref:`int<class_int>` id **)** const
  112. Return the offset of the tile's navigation polygon.
  113. .. _class_TileSet_tile_get_occluder_offset:
  114. - :ref:`Vector2<class_vector2>` **tile_get_occluder_offset** **(** :ref:`int<class_int>` id **)** const
  115. Return the offset of the tile's light occluder.
  116. .. _class_TileSet_tile_get_region:
  117. - :ref:`Rect2<class_rect2>` **tile_get_region** **(** :ref:`int<class_int>` id **)** const
  118. Return the tile sub-region in the texture.
  119. .. _class_TileSet_tile_get_shape:
  120. - :ref:`Shape2D<class_shape2d>` **tile_get_shape** **(** :ref:`int<class_int>` id **)** const
  121. Return the shape of the tile.
  122. .. _class_TileSet_tile_get_shape_offset:
  123. - :ref:`Vector2<class_vector2>` **tile_get_shape_offset** **(** :ref:`int<class_int>` id **)** const
  124. Return the shape offset of the tile.
  125. .. _class_TileSet_tile_get_shapes:
  126. - :ref:`Array<class_array>` **tile_get_shapes** **(** :ref:`int<class_int>` id **)** const
  127. Return the array of shapes of the tile.
  128. .. _class_TileSet_tile_get_texture:
  129. - :ref:`Texture<class_texture>` **tile_get_texture** **(** :ref:`int<class_int>` id **)** const
  130. Return the texture of the tile.
  131. .. _class_TileSet_tile_get_texture_offset:
  132. - :ref:`Vector2<class_vector2>` **tile_get_texture_offset** **(** :ref:`int<class_int>` id **)** const
  133. Return the texture offset of the tile.
  134. .. _class_TileSet_tile_set_light_occluder:
  135. - void **tile_set_light_occluder** **(** :ref:`int<class_int>` id, :ref:`OccluderPolygon2D<class_occluderpolygon2d>` light_occluder **)**
  136. Set a light occluder for the tile.
  137. .. _class_TileSet_tile_set_material:
  138. - void **tile_set_material** **(** :ref:`int<class_int>` id, :ref:`CanvasItemMaterial<class_canvasitemmaterial>` material **)**
  139. Set the material of the tile.
  140. .. _class_TileSet_tile_set_name:
  141. - void **tile_set_name** **(** :ref:`int<class_int>` id, :ref:`String<class_string>` name **)**
  142. Set the name of the tile, for descriptive purposes.
  143. .. _class_TileSet_tile_set_navigation_polygon:
  144. - void **tile_set_navigation_polygon** **(** :ref:`int<class_int>` id, :ref:`NavigationPolygon<class_navigationpolygon>` navigation_polygon **)**
  145. Set a navigation polygon for the tile.
  146. .. _class_TileSet_tile_set_navigation_polygon_offset:
  147. - void **tile_set_navigation_polygon_offset** **(** :ref:`int<class_int>` id, :ref:`Vector2<class_vector2>` navigation_polygon_offset **)**
  148. Set an offset for the tile's navigation polygon.
  149. .. _class_TileSet_tile_set_occluder_offset:
  150. - void **tile_set_occluder_offset** **(** :ref:`int<class_int>` id, :ref:`Vector2<class_vector2>` occluder_offset **)**
  151. Set an offset for the tile's light occluder.
  152. .. _class_TileSet_tile_set_region:
  153. - void **tile_set_region** **(** :ref:`int<class_int>` id, :ref:`Rect2<class_rect2>` region **)**
  154. Set the tile sub-region in the texture. This is common in texture atlases.
  155. .. _class_TileSet_tile_set_shape:
  156. - void **tile_set_shape** **(** :ref:`int<class_int>` id, :ref:`Shape2D<class_shape2d>` shape **)**
  157. Set a shape for the tile, enabling physics to collide with it.
  158. .. _class_TileSet_tile_set_shape_offset:
  159. - void **tile_set_shape_offset** **(** :ref:`int<class_int>` id, :ref:`Vector2<class_vector2>` shape_offset **)**
  160. Set the shape offset of the tile.
  161. .. _class_TileSet_tile_set_shapes:
  162. - void **tile_set_shapes** **(** :ref:`int<class_int>` id, :ref:`Array<class_array>` shapes **)**
  163. Set an array of shapes for the tile, enabling physics to collide with it.
  164. .. _class_TileSet_tile_set_texture:
  165. - void **tile_set_texture** **(** :ref:`int<class_int>` id, :ref:`Texture<class_texture>` texture **)**
  166. Set the texture of the tile.
  167. .. _class_TileSet_tile_set_texture_offset:
  168. - void **tile_set_texture_offset** **(** :ref:`int<class_int>` id, :ref:`Vector2<class_vector2>` texture_offset **)**
  169. Set the texture offset of the tile.