class_tilemap.rst 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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_TileMap:
  4. TileMap
  5. =======
  6. **Inherits:** :ref:`Node2D<class_node2d>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Node for 2D tile-based games.
  11. Member Functions
  12. ----------------
  13. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  14. | void | :ref:`clear<class_TileMap_clear>` **(** **)** |
  15. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`int<class_int>` | :ref:`get_cell<class_TileMap_get_cell>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const |
  17. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`Vector2<class_vector2>` | :ref:`get_cell_size<class_TileMap_get_cell_size>` **(** **)** const |
  19. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`int<class_int>` | :ref:`get_cellv<class_TileMap_get_cellv>` **(** :ref:`Vector2<class_vector2>` pos **)** const |
  21. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`get_center_x<class_TileMap_get_center_x>` **(** **)** const |
  23. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`get_center_y<class_TileMap_get_center_y>` **(** **)** const |
  25. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`float<class_float>` | :ref:`get_collision_bounce<class_TileMap_get_collision_bounce>` **(** **)** const |
  27. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`float<class_float>` | :ref:`get_collision_friction<class_TileMap_get_collision_friction>` **(** **)** const |
  29. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`int<class_int>` | :ref:`get_collision_layer<class_TileMap_get_collision_layer>` **(** **)** const |
  31. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`bool<class_bool>` | :ref:`get_collision_layer_bit<class_TileMap_get_collision_layer_bit>` **(** :ref:`int<class_int>` bit **)** const |
  33. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`int<class_int>` | :ref:`get_collision_mask<class_TileMap_get_collision_mask>` **(** **)** const |
  35. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`bool<class_bool>` | :ref:`get_collision_mask_bit<class_TileMap_get_collision_mask_bit>` **(** :ref:`int<class_int>` bit **)** const |
  37. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`bool<class_bool>` | :ref:`get_collision_use_kinematic<class_TileMap_get_collision_use_kinematic>` **(** **)** const |
  39. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`Matrix32<class_matrix32>` | :ref:`get_custom_transform<class_TileMap_get_custom_transform>` **(** **)** const |
  41. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`int<class_int>` | :ref:`get_half_offset<class_TileMap_get_half_offset>` **(** **)** const |
  43. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`int<class_int>` | :ref:`get_mode<class_TileMap_get_mode>` **(** **)** const |
  45. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`int<class_int>` | :ref:`get_occluder_light_mask<class_TileMap_get_occluder_light_mask>` **(** **)** const |
  47. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`int<class_int>` | :ref:`get_quadrant_size<class_TileMap_get_quadrant_size>` **(** **)** const |
  49. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`int<class_int>` | :ref:`get_tile_origin<class_TileMap_get_tile_origin>` **(** **)** const |
  51. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`TileSet<class_tileset>` | :ref:`get_tileset<class_TileMap_get_tileset>` **(** **)** const |
  53. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`Array<class_array>` | :ref:`get_used_cells<class_TileMap_get_used_cells>` **(** **)** const |
  55. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`Array<class_array>` | :ref:`get_used_cells_by_id<class_TileMap_get_used_cells_by_id>` **(** :ref:`int<class_int>` id **)** const |
  57. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`Rect2<class_rect2>` | :ref:`get_used_rect<class_TileMap_get_used_rect>` **(** **)** |
  59. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`bool<class_bool>` | :ref:`is_cell_transposed<class_TileMap_is_cell_transposed>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const |
  61. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`bool<class_bool>` | :ref:`is_cell_x_flipped<class_TileMap_is_cell_x_flipped>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const |
  63. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`bool<class_bool>` | :ref:`is_cell_y_flipped<class_TileMap_is_cell_y_flipped>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const |
  65. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`bool<class_bool>` | :ref:`is_y_sort_mode_enabled<class_TileMap_is_y_sort_mode_enabled>` **(** **)** const |
  67. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`Vector2<class_vector2>` | :ref:`map_to_world<class_TileMap_map_to_world>` **(** :ref:`Vector2<class_vector2>` mappos, :ref:`bool<class_bool>` ignore_half_ofs=false **)** const |
  69. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | void | :ref:`set_cell<class_TileMap_set_cell>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` tile, :ref:`bool<class_bool>` flip_x=false, :ref:`bool<class_bool>` flip_y=false, :ref:`bool<class_bool>` transpose=false **)** |
  71. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | void | :ref:`set_cell_size<class_TileMap_set_cell_size>` **(** :ref:`Vector2<class_vector2>` size **)** |
  73. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | void | :ref:`set_cellv<class_TileMap_set_cellv>` **(** :ref:`Vector2<class_vector2>` pos, :ref:`int<class_int>` tile, :ref:`bool<class_bool>` flip_x=false, :ref:`bool<class_bool>` flip_y=false, :ref:`bool<class_bool>` transpose=false **)** |
  75. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | void | :ref:`set_center_x<class_TileMap_set_center_x>` **(** :ref:`bool<class_bool>` enable **)** |
  77. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | void | :ref:`set_center_y<class_TileMap_set_center_y>` **(** :ref:`bool<class_bool>` enable **)** |
  79. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | void | :ref:`set_collision_bounce<class_TileMap_set_collision_bounce>` **(** :ref:`float<class_float>` value **)** |
  81. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | void | :ref:`set_collision_friction<class_TileMap_set_collision_friction>` **(** :ref:`float<class_float>` value **)** |
  83. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | void | :ref:`set_collision_layer<class_TileMap_set_collision_layer>` **(** :ref:`int<class_int>` layer **)** |
  85. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | void | :ref:`set_collision_layer_bit<class_TileMap_set_collision_layer_bit>` **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)** |
  87. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | void | :ref:`set_collision_mask<class_TileMap_set_collision_mask>` **(** :ref:`int<class_int>` mask **)** |
  89. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | void | :ref:`set_collision_mask_bit<class_TileMap_set_collision_mask_bit>` **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)** |
  91. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | void | :ref:`set_collision_use_kinematic<class_TileMap_set_collision_use_kinematic>` **(** :ref:`bool<class_bool>` use_kinematic **)** |
  93. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | void | :ref:`set_custom_transform<class_TileMap_set_custom_transform>` **(** :ref:`Matrix32<class_matrix32>` custom_transform **)** |
  95. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | void | :ref:`set_half_offset<class_TileMap_set_half_offset>` **(** :ref:`int<class_int>` half_offset **)** |
  97. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | void | :ref:`set_mode<class_TileMap_set_mode>` **(** :ref:`int<class_int>` mode **)** |
  99. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | void | :ref:`set_occluder_light_mask<class_TileMap_set_occluder_light_mask>` **(** :ref:`int<class_int>` mask **)** |
  101. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | void | :ref:`set_quadrant_size<class_TileMap_set_quadrant_size>` **(** :ref:`int<class_int>` size **)** |
  103. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | void | :ref:`set_tile_origin<class_TileMap_set_tile_origin>` **(** :ref:`int<class_int>` origin **)** |
  105. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | void | :ref:`set_tileset<class_TileMap_set_tileset>` **(** :ref:`TileSet<class_tileset>` tileset **)** |
  107. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | void | :ref:`set_y_sort_mode<class_TileMap_set_y_sort_mode>` **(** :ref:`bool<class_bool>` enable **)** |
  109. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | :ref:`Vector2<class_vector2>` | :ref:`world_to_map<class_TileMap_world_to_map>` **(** :ref:`Vector2<class_vector2>` worldpos **)** const |
  111. +----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. Signals
  113. -------
  114. - **settings_changed** **(** **)**
  115. Signal indicating that a tilemap setting has changed.
  116. Numeric Constants
  117. -----------------
  118. - **INVALID_CELL** = **-1** --- Returned when a cell doesn't exist.
  119. - **MODE_SQUARE** = **0** --- Orthogonal orientation mode.
  120. - **MODE_ISOMETRIC** = **1** --- Isometric orientation mode.
  121. - **MODE_CUSTOM** = **2** --- Custom orientation mode.
  122. - **HALF_OFFSET_X** = **0** --- Half offset on the X coordinate.
  123. - **HALF_OFFSET_Y** = **1** --- Half offset on the Y coordinate.
  124. - **HALF_OFFSET_DISABLED** = **2** --- Half offset disabled.
  125. - **TILE_ORIGIN_TOP_LEFT** = **0** --- Tile origin at its top-left corner.
  126. - **TILE_ORIGIN_CENTER** = **1** --- Tile origin at its center.
  127. - **TILE_ORIGIN_BOTTOM_LEFT** = **2**
  128. Description
  129. -----------
  130. Node for 2D tile-based games. Tilemaps use a :ref:`TileSet<class_tileset>` which contain a list of tiles (textures, their rect and a collision) and are used to create complex grid-based maps.
  131. To optimize drawing and culling (sort of like :ref:`GridMap<class_gridmap>`), you can specify a quadrant size, so chunks of the map will be batched together at drawing time.
  132. Member Function Description
  133. ---------------------------
  134. .. _class_TileMap_clear:
  135. - void **clear** **(** **)**
  136. Clear all cells.
  137. .. _class_TileMap_get_cell:
  138. - :ref:`int<class_int>` **get_cell** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const
  139. Return the tile index of the referenced cell.
  140. .. _class_TileMap_get_cell_size:
  141. - :ref:`Vector2<class_vector2>` **get_cell_size** **(** **)** const
  142. Return the cell size.
  143. .. _class_TileMap_get_cellv:
  144. - :ref:`int<class_int>` **get_cellv** **(** :ref:`Vector2<class_vector2>` pos **)** const
  145. Return the tile index of the cell referenced by a Vector2.
  146. .. _class_TileMap_get_center_x:
  147. - :ref:`bool<class_bool>` **get_center_x** **(** **)** const
  148. Return true if tiles are to be centered in x coordinate (by default this is false and they are drawn from upper left cell corner).
  149. .. _class_TileMap_get_center_y:
  150. - :ref:`bool<class_bool>` **get_center_y** **(** **)** const
  151. Return true if tiles are to be centered in y coordinate (by default this is false and they are drawn from upper left cell corner).
  152. .. _class_TileMap_get_collision_bounce:
  153. - :ref:`float<class_float>` **get_collision_bounce** **(** **)** const
  154. Return the collision bounce parameter.
  155. .. _class_TileMap_get_collision_friction:
  156. - :ref:`float<class_float>` **get_collision_friction** **(** **)** const
  157. Return the collision friction parameter.
  158. .. _class_TileMap_get_collision_layer:
  159. - :ref:`int<class_int>` **get_collision_layer** **(** **)** const
  160. Return the collision layer.
  161. .. _class_TileMap_get_collision_layer_bit:
  162. - :ref:`bool<class_bool>` **get_collision_layer_bit** **(** :ref:`int<class_int>` bit **)** const
  163. .. _class_TileMap_get_collision_mask:
  164. - :ref:`int<class_int>` **get_collision_mask** **(** **)** const
  165. Return the collision mask.
  166. .. _class_TileMap_get_collision_mask_bit:
  167. - :ref:`bool<class_bool>` **get_collision_mask_bit** **(** :ref:`int<class_int>` bit **)** const
  168. .. _class_TileMap_get_collision_use_kinematic:
  169. - :ref:`bool<class_bool>` **get_collision_use_kinematic** **(** **)** const
  170. Return whether the tilemap handles collisions as a kinematic body.
  171. .. _class_TileMap_get_custom_transform:
  172. - :ref:`Matrix32<class_matrix32>` **get_custom_transform** **(** **)** const
  173. Return the custom transform matrix.
  174. .. _class_TileMap_get_half_offset:
  175. - :ref:`int<class_int>` **get_half_offset** **(** **)** const
  176. Return the current half offset configuration.
  177. .. _class_TileMap_get_mode:
  178. - :ref:`int<class_int>` **get_mode** **(** **)** const
  179. Return the orientation mode.
  180. .. _class_TileMap_get_occluder_light_mask:
  181. - :ref:`int<class_int>` **get_occluder_light_mask** **(** **)** const
  182. .. _class_TileMap_get_quadrant_size:
  183. - :ref:`int<class_int>` **get_quadrant_size** **(** **)** const
  184. Return the quadrant size.
  185. .. _class_TileMap_get_tile_origin:
  186. - :ref:`int<class_int>` **get_tile_origin** **(** **)** const
  187. Return the tile origin configuration.
  188. .. _class_TileMap_get_tileset:
  189. - :ref:`TileSet<class_tileset>` **get_tileset** **(** **)** const
  190. Return the current tileset.
  191. .. _class_TileMap_get_used_cells:
  192. - :ref:`Array<class_array>` **get_used_cells** **(** **)** const
  193. Return an array of all cells containing a tile from the tileset (i.e. a tile index different from -1).
  194. .. _class_TileMap_get_used_cells_by_id:
  195. - :ref:`Array<class_array>` **get_used_cells_by_id** **(** :ref:`int<class_int>` id **)** const
  196. .. _class_TileMap_get_used_rect:
  197. - :ref:`Rect2<class_rect2>` **get_used_rect** **(** **)**
  198. .. _class_TileMap_is_cell_transposed:
  199. - :ref:`bool<class_bool>` **is_cell_transposed** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const
  200. Return whether the referenced cell is transposed, i.e. the X and Y axes are swapped (mirroring with regard to the (1,1) vector).
  201. .. _class_TileMap_is_cell_x_flipped:
  202. - :ref:`bool<class_bool>` **is_cell_x_flipped** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const
  203. Return whether the referenced cell is flipped over the X axis.
  204. .. _class_TileMap_is_cell_y_flipped:
  205. - :ref:`bool<class_bool>` **is_cell_y_flipped** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const
  206. Return whether the referenced cell is flipped over the Y axis.
  207. .. _class_TileMap_is_y_sort_mode_enabled:
  208. - :ref:`bool<class_bool>` **is_y_sort_mode_enabled** **(** **)** const
  209. Return the Y sort mode.
  210. .. _class_TileMap_map_to_world:
  211. - :ref:`Vector2<class_vector2>` **map_to_world** **(** :ref:`Vector2<class_vector2>` mappos, :ref:`bool<class_bool>` ignore_half_ofs=false **)** const
  212. Return the absolute world position corresponding to the tilemap (grid-based) coordinates given as an argument.
  213. Optionally, the tilemap's potential half offset can be ignored.
  214. .. _class_TileMap_set_cell:
  215. - void **set_cell** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` tile, :ref:`bool<class_bool>` flip_x=false, :ref:`bool<class_bool>` flip_y=false, :ref:`bool<class_bool>` transpose=false **)**
  216. Set the tile index for the cell referenced by its grid-based X and Y coordinates.
  217. A tile index of -1 clears the cell.
  218. Optionally, the tile can also be flipped over the X and Y coordinates or transposed.
  219. .. _class_TileMap_set_cell_size:
  220. - void **set_cell_size** **(** :ref:`Vector2<class_vector2>` size **)**
  221. Set the cell size.
  222. .. _class_TileMap_set_cellv:
  223. - void **set_cellv** **(** :ref:`Vector2<class_vector2>` pos, :ref:`int<class_int>` tile, :ref:`bool<class_bool>` flip_x=false, :ref:`bool<class_bool>` flip_y=false, :ref:`bool<class_bool>` transpose=false **)**
  224. Set the tile index for the cell referenced by a Vector2 of grid-based coordinates.
  225. A tile index of -1 clears the cell.
  226. Optionally, the tile can also be flipped over the X and Y axes or transposed.
  227. .. _class_TileMap_set_center_x:
  228. - void **set_center_x** **(** :ref:`bool<class_bool>` enable **)**
  229. Set tiles to be centered in x coordinate. (by default this is false and they are drawn from upper left cell corner).
  230. .. _class_TileMap_set_center_y:
  231. - void **set_center_y** **(** :ref:`bool<class_bool>` enable **)**
  232. Set tiles to be centered in y coordinate. (by default this is false and they are drawn from upper left cell corner).
  233. .. _class_TileMap_set_collision_bounce:
  234. - void **set_collision_bounce** **(** :ref:`float<class_float>` value **)**
  235. Set the collision bounce parameter. Allowable values range from 0 to 1.
  236. .. _class_TileMap_set_collision_friction:
  237. - void **set_collision_friction** **(** :ref:`float<class_float>` value **)**
  238. Set the collision friction parameter. Allowable values range from 0 to 1.
  239. .. _class_TileMap_set_collision_layer:
  240. - void **set_collision_layer** **(** :ref:`int<class_int>` layer **)**
  241. Set the collision layer.
  242. Layers are referenced by binary indexes, so allowable values to describe the 20 available layers range from 0 to 2^20-1.
  243. .. _class_TileMap_set_collision_layer_bit:
  244. - void **set_collision_layer_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
  245. .. _class_TileMap_set_collision_mask:
  246. - void **set_collision_mask** **(** :ref:`int<class_int>` mask **)**
  247. Set the collision masks.
  248. Masks are referenced by binary indexes, so allowable values to describe the 20 available masks range from 0 to 2^20-1.
  249. .. _class_TileMap_set_collision_mask_bit:
  250. - void **set_collision_mask_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
  251. .. _class_TileMap_set_collision_use_kinematic:
  252. - void **set_collision_use_kinematic** **(** :ref:`bool<class_bool>` use_kinematic **)**
  253. Set the tilemap to handle collisions as a kinematic body (enabled) or a static body (disabled).
  254. .. _class_TileMap_set_custom_transform:
  255. - void **set_custom_transform** **(** :ref:`Matrix32<class_matrix32>` custom_transform **)**
  256. Set custom transform matrix, to use in combination with the custom orientation mode.
  257. .. _class_TileMap_set_half_offset:
  258. - void **set_half_offset** **(** :ref:`int<class_int>` half_offset **)**
  259. Set an half offset on the X coordinate, Y coordinate, or none (use HALF_OFFSET\_\* constants as argument).
  260. Half offset sets every other tile off by a half tile size in the specified direction.
  261. .. _class_TileMap_set_mode:
  262. - void **set_mode** **(** :ref:`int<class_int>` mode **)**
  263. Set the orientation mode as square, isometric or custom (use MODE\_\* constants as argument).
  264. .. _class_TileMap_set_occluder_light_mask:
  265. - void **set_occluder_light_mask** **(** :ref:`int<class_int>` mask **)**
  266. .. _class_TileMap_set_quadrant_size:
  267. - void **set_quadrant_size** **(** :ref:`int<class_int>` size **)**
  268. Set the quadrant size, this optimizes drawing by batching chunks of map at draw/cull time.
  269. Allowed values are integers ranging from 1 to 128.
  270. .. _class_TileMap_set_tile_origin:
  271. - void **set_tile_origin** **(** :ref:`int<class_int>` origin **)**
  272. Set the tile origin to the tile center or its top-left corner (use TILE_ORIGIN\_\* constants as argument).
  273. .. _class_TileMap_set_tileset:
  274. - void **set_tileset** **(** :ref:`TileSet<class_tileset>` tileset **)**
  275. Set the current tileset.
  276. .. _class_TileMap_set_y_sort_mode:
  277. - void **set_y_sort_mode** **(** :ref:`bool<class_bool>` enable **)**
  278. Set the Y sort mode. Enabled Y sort mode means that children of the tilemap will be drawn in the order defined by their Y coordinate.
  279. A tile with a higher Y coordinate will therefore be drawn later, potentially covering up the tile(s) above it if its sprite is higher than its cell size.
  280. .. _class_TileMap_world_to_map:
  281. - :ref:`Vector2<class_vector2>` **world_to_map** **(** :ref:`Vector2<class_vector2>` worldpos **)** const
  282. Return the tilemap (grid-based) coordinates corresponding to the absolute world position given as an argument.