summaryrefslogtreecommitdiff
path: root/doc/classes/TileMap.xml
blob: dd7707229cc84271672b52d46280cb29913f17b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TileMap" inherits="Node2D" category="Core" version="3.0-beta">
	<brief_description>
		Node for 2D tile-based maps.
	</brief_description>
	<description>
		Node for 2D tile-based maps. Tilemaps use a [TileSet] which contain a list of tiles (textures plus optional collision, navigation, and/or occluder shapes) which are used to create grid-based maps.
	</description>
	<tutorials>
	</tutorials>
	<demos>
	</demos>
	<methods>
		<method name="clear">
			<return type="void">
			</return>
			<description>
				Clear all cells.
			</description>
		</method>
		<method name="get_cell" qualifiers="const">
			<return type="int">
			</return>
			<argument index="0" name="x" type="int">
			</argument>
			<argument index="1" name="y" type="int">
			</argument>
			<description>
				Return the tile index of the referenced cell.
			</description>
		</method>
		<method name="get_cell_size" qualifiers="const">
			<return type="Vector2">
			</return>
			<description>
				Return the cell size.
			</description>
		</method>
		<method name="get_cellv" qualifiers="const">
			<return type="int">
			</return>
			<argument index="0" name="position" type="Vector2">
			</argument>
			<description>
				Return the tile index of the cell referenced by a Vector2.
			</description>
		</method>
		<method name="get_center_x" qualifiers="const">
			<return type="bool">
			</return>
			<description>
				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).
			</description>
		</method>
		<method name="get_center_y" qualifiers="const">
			<return type="bool">
			</return>
			<description>
				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).
			</description>
		</method>
		<method name="get_clip_uv" qualifiers="const">
			<return type="bool">
			</return>
			<description>
			</description>
		</method>
		<method name="get_collision_bounce" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Return the collision bounce parameter.
			</description>
		</method>
		<method name="get_collision_friction" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Return the collision friction parameter.
			</description>
		</method>
		<method name="get_collision_layer" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Return the collision layer.
			</description>
		</method>
		<method name="get_collision_layer_bit" qualifiers="const">
			<return type="bool">
			</return>
			<argument index="0" name="bit" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_collision_mask" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Return the collision mask.
			</description>
		</method>
		<method name="get_collision_mask_bit" qualifiers="const">
			<return type="bool">
			</return>
			<argument index="0" name="bit" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_collision_use_kinematic" qualifiers="const">
			<return type="bool">
			</return>
			<description>
				Return whether the tilemap handles collisions as a kinematic body.
			</description>
		</method>
		<method name="get_custom_transform" qualifiers="const">
			<return type="Transform2D">
			</return>
			<description>
				Return the custom transform matrix.
			</description>
		</method>
		<method name="get_half_offset" qualifiers="const">
			<return type="int" enum="TileMap.HalfOffset">
			</return>
			<description>
				Return the current half offset configuration.
			</description>
		</method>
		<method name="get_mode" qualifiers="const">
			<return type="int" enum="TileMap.Mode">
			</return>
			<description>
				Return the orientation mode.
			</description>
		</method>
		<method name="get_occluder_light_mask" qualifiers="const">
			<return type="int">
			</return>
			<description>
			</description>
		</method>
		<method name="get_quadrant_size" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Return the quadrant size.
			</description>
		</method>
		<method name="get_tile_origin" qualifiers="const">
			<return type="int" enum="TileMap.TileOrigin">
			</return>
			<description>
				Return the tile origin configuration.
			</description>
		</method>
		<method name="get_tileset" qualifiers="const">
			<return type="TileSet">
			</return>
			<description>
				Return the current tileset.
			</description>
		</method>
		<method name="get_used_cells" qualifiers="const">
			<return type="Array">
			</return>
			<description>
				Return an array of all cells containing a tile from the tileset (i.e. a tile index different from -1).
			</description>
		</method>
		<method name="get_used_cells_by_id" qualifiers="const">
			<return type="Array">
			</return>
			<argument index="0" name="id" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="get_used_rect">
			<return type="Rect2">
			</return>
			<description>
			</description>
		</method>
		<method name="is_cell_transposed" qualifiers="const">
			<return type="bool">
			</return>
			<argument index="0" name="x" type="int">
			</argument>
			<argument index="1" name="y" type="int">
			</argument>
			<description>
				Return whether the referenced cell is transposed, i.e. the X and Y axes are swapped (mirroring with regard to the (1,1) vector).
			</description>
		</method>
		<method name="is_cell_x_flipped" qualifiers="const">
			<return type="bool">
			</return>
			<argument index="0" name="x" type="int">
			</argument>
			<argument index="1" name="y" type="int">
			</argument>
			<description>
				Return whether the referenced cell is flipped over the X axis.
			</description>
		</method>
		<method name="is_cell_y_flipped" qualifiers="const">
			<return type="bool">
			</return>
			<argument index="0" name="x" type="int">
			</argument>
			<argument index="1" name="y" type="int">
			</argument>
			<description>
				Return whether the referenced cell is flipped over the Y axis.
			</description>
		</method>
		<method name="is_y_sort_mode_enabled" qualifiers="const">
			<return type="bool">
			</return>
			<description>
				Return the Y sort mode.
			</description>
		</method>
		<method name="map_to_world" qualifiers="const">
			<return type="Vector2">
			</return>
			<argument index="0" name="map_position" type="Vector2">
			</argument>
			<argument index="1" name="ignore_half_ofs" type="bool" default="false">
			</argument>
			<description>
				Return the absolute world position corresponding to the tilemap (grid-based) coordinates given as an argument.
				Optionally, the tilemap's potential half offset can be ignored.
			</description>
		</method>
		<method name="set_cell">
			<return type="void">
			</return>
			<argument index="0" name="x" type="int">
			</argument>
			<argument index="1" name="y" type="int">
			</argument>
			<argument index="2" name="tile" type="int">
			</argument>
			<argument index="3" name="flip_x" type="bool" default="false">
			</argument>
			<argument index="4" name="flip_y" type="bool" default="false">
			</argument>
			<argument index="5" name="transpose" type="bool" default="false">
			</argument>
			<argument index="6" name="autotile_coord" type="Vector2" default="Vector2( 0, 0 )">
			</argument>
			<description>
				Set the tile index for the cell referenced by its grid-based X and Y coordinates.
				A tile index of -1 clears the cell.
				Optionally, the tile can also be flipped over the X and Y coordinates, transposed, or be given autotile coordinates.
			</description>
		</method>
		<method name="set_cell_size">
			<return type="void">
			</return>
			<argument index="0" name="size" type="Vector2">
			</argument>
			<description>
				Set the cell size.
			</description>
		</method>
		<method name="set_cellv">
			<return type="void">
			</return>
			<argument index="0" name="position" type="Vector2">
			</argument>
			<argument index="1" name="tile" type="int">
			</argument>
			<argument index="2" name="flip_x" type="bool" default="false">
			</argument>
			<argument index="3" name="flip_y" type="bool" default="false">
			</argument>
			<argument index="4" name="transpose" type="bool" default="false">
			</argument>
			<description>
				Set the tile index for the cell referenced by a Vector2 of grid-based coordinates.
				A tile index of -1 clears the cell.
				Optionally, the tile can also be flipped over the X and Y axes or transposed.
			</description>
		</method>
		<method name="set_center_x">
			<return type="void">
			</return>
			<argument index="0" name="enable" type="bool">
			</argument>
			<description>
				Set tiles to be centered in x coordinate. (by default this is false and they are drawn from upper left cell corner).
			</description>
		</method>
		<method name="set_center_y">
			<return type="void">
			</return>
			<argument index="0" name="enable" type="bool">
			</argument>
			<description>
				Set tiles to be centered in y coordinate. (by default this is false and they are drawn from upper left cell corner).
			</description>
		</method>
		<method name="set_clip_uv">
			<return type="void">
			</return>
			<argument index="0" name="enable" type="bool">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_collision_bounce">
			<return type="void">
			</return>
			<argument index="0" name="value" type="float">
			</argument>
			<description>
				Set the collision bounce parameter. Allowable values range from 0 to 1.
			</description>
		</method>
		<method name="set_collision_friction">
			<return type="void">
			</return>
			<argument index="0" name="value" type="float">
			</argument>
			<description>
				Set the collision friction parameter. Allowable values range from 0 to 1.
			</description>
		</method>
		<method name="set_collision_layer">
			<return type="void">
			</return>
			<argument index="0" name="layer" type="int">
			</argument>
			<description>
				Set the collision layer.
				Layers are referenced by binary indexes, so allowable values to describe the 20 available layers range from 0 to 2^20-1.
			</description>
		</method>
		<method name="set_collision_layer_bit">
			<return type="void">
			</return>
			<argument index="0" name="bit" type="int">
			</argument>
			<argument index="1" name="value" type="bool">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_collision_mask">
			<return type="void">
			</return>
			<argument index="0" name="mask" type="int">
			</argument>
			<description>
				Set the collision masks.
				Masks are referenced by binary indexes, so allowable values to describe the 20 available masks range from 0 to 2^20-1.
			</description>
		</method>
		<method name="set_collision_mask_bit">
			<return type="void">
			</return>
			<argument index="0" name="bit" type="int">
			</argument>
			<argument index="1" name="value" type="bool">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_collision_use_kinematic">
			<return type="void">
			</return>
			<argument index="0" name="use_kinematic" type="bool">
			</argument>
			<description>
				Set the tilemap to handle collisions as a kinematic body (enabled) or a static body (disabled).
			</description>
		</method>
		<method name="set_custom_transform">
			<return type="void">
			</return>
			<argument index="0" name="custom_transform" type="Transform2D">
			</argument>
			<description>
				Set custom transform matrix, to use in combination with the custom orientation mode.
			</description>
		</method>
		<method name="set_half_offset">
			<return type="void">
			</return>
			<argument index="0" name="half_offset" type="int" enum="TileMap.HalfOffset">
			</argument>
			<description>
				Set a half offset on the X coordinate, Y coordinate, or none (use HALF_OFFSET_* constants as argument).
				Half offset sets every other tile off by a half tile size in the specified direction.
			</description>
		</method>
		<method name="set_mode">
			<return type="void">
			</return>
			<argument index="0" name="mode" type="int" enum="TileMap.Mode">
			</argument>
			<description>
				Set the orientation mode as square, isometric or custom (use MODE_* constants as argument).
			</description>
		</method>
		<method name="set_occluder_light_mask">
			<return type="void">
			</return>
			<argument index="0" name="mask" type="int">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_quadrant_size">
			<return type="void">
			</return>
			<argument index="0" name="size" type="int">
			</argument>
			<description>
				Set the quadrant size, this optimizes drawing by batching chunks of map at draw/cull time.
				Allowed values are integers ranging from 1 to 128.
			</description>
		</method>
		<method name="set_tile_origin">
			<return type="void">
			</return>
			<argument index="0" name="origin" type="int" enum="TileMap.TileOrigin">
			</argument>
			<description>
				Set the tile origin to the tile center or its top-left corner (use TILE_ORIGIN_* constants as argument).
			</description>
		</method>
		<method name="set_tileset">
			<return type="void">
			</return>
			<argument index="0" name="tileset" type="TileSet">
			</argument>
			<description>
				Set the current tileset.
			</description>
		</method>
		<method name="set_y_sort_mode">
			<return type="void">
			</return>
			<argument index="0" name="enable" type="bool">
			</argument>
			<description>
				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.
				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.
			</description>
		</method>
		<method name="world_to_map" qualifiers="const">
			<return type="Vector2">
			</return>
			<argument index="0" name="world_position" type="Vector2">
			</argument>
			<description>
				Return the tilemap (grid-based) coordinates corresponding to the absolute world position given as an argument.
			</description>
		</method>
	</methods>
	<members>
		<member name="cell_clip_uv" type="bool" setter="set_clip_uv" getter="get_clip_uv">
		</member>
		<member name="cell_custom_transform" type="Transform2D" setter="set_custom_transform" getter="get_custom_transform">
			The custom [Transform2D] to be applied to the TileMap's cells.
		</member>
		<member name="cell_half_offset" type="int" setter="set_half_offset" getter="get_half_offset" enum="TileMap.HalfOffset">
			Amount to offset alternating tiles. Uses HALF_OFFSET_* constants. Default value: HALF_OFFSET_DISABLED.
		</member>
		<member name="cell_quadrant_size" type="int" setter="set_quadrant_size" getter="get_quadrant_size">
			The TileMap's quadrant size.  Optimizes drawing by batching, using chunks of this size. Default value: 16.
		</member>
		<member name="cell_size" type="Vector2" setter="set_cell_size" getter="get_cell_size">
			The TileMap's cell size.
		</member>
		<member name="cell_tile_origin" type="int" setter="set_tile_origin" getter="get_tile_origin" enum="TileMap.TileOrigin">
			Position for tile origin. Uses TILE_ORIGIN_* constants. Default value: TILE_ORIGIN_TOP_LEFT.
		</member>
		<member name="cell_y_sort" type="bool" setter="set_y_sort_mode" getter="is_y_sort_mode_enabled">
			If [code]true[/code] the TileMap's children will be drawn in order of their Y coordinate. Default value: [code]false[/code].
		</member>
		<member name="collision_bounce" type="float" setter="set_collision_bounce" getter="get_collision_bounce">
			Bounce value for static body collisions (see [code]collision_use_kinematic[/code]). Default value: 0.
		</member>
		<member name="collision_friction" type="float" setter="set_collision_friction" getter="get_collision_friction">
			Friction value for static body collisions (see [code]collision_use_kinematic[/code]). Default value: 1.
		</member>
		<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
			The collision layer(s) for all colliders in the TileMap.
		</member>
		<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
			The collision mask(s) for all colliders in the TileMap.
		</member>
		<member name="collision_use_kinematic" type="bool" setter="set_collision_use_kinematic" getter="get_collision_use_kinematic">
			If [code]true[/code] TileMap collisions will be handled as a kinematic body. If [code]false[/code] collisions will be handled as static body. Default value: [code]false[/code].
		</member>
		<member name="mode" type="int" setter="set_mode" getter="get_mode" enum="TileMap.Mode">
			The TileMap orientation mode. Uses MODE_* constants. Default value: MODE_SQUARE.
		</member>
		<member name="occluder_light_mask" type="int" setter="set_occluder_light_mask" getter="get_occluder_light_mask">
			The light mask assigned to all light occluders in the TileMap.  The TileSet's light occluders will cast shadows only from Light2D(s) that have the same light mask(s).
		</member>
		<member name="tile_set" type="TileSet" setter="set_tileset" getter="get_tileset">
			The assigned [TileSet].
		</member>
	</members>
	<signals>
		<signal name="settings_changed">
			<description>
				Emitted when a tilemap setting has changed.
			</description>
		</signal>
	</signals>
	<constants>
		<constant name="INVALID_CELL" value="-1" enum="">
			Returned when a cell doesn't exist.
		</constant>
		<constant name="MODE_SQUARE" value="0">
			Orthogonal orientation mode.
		</constant>
		<constant name="MODE_ISOMETRIC" value="1">
			Isometric orientation mode.
		</constant>
		<constant name="MODE_CUSTOM" value="2">
			Custom orientation mode.
		</constant>
		<constant name="HALF_OFFSET_X" value="0">
			Half offset on the X coordinate.
		</constant>
		<constant name="HALF_OFFSET_Y" value="1">
			Half offset on the Y coordinate.
		</constant>
		<constant name="HALF_OFFSET_DISABLED" value="2">
			Half offset disabled.
		</constant>
		<constant name="TILE_ORIGIN_TOP_LEFT" value="0">
			Tile origin at its top-left corner.
		</constant>
		<constant name="TILE_ORIGIN_CENTER" value="1">
			Tile origin at its center.
		</constant>
		<constant name="TILE_ORIGIN_BOTTOM_LEFT" value="2">
		</constant>
	</constants>
</class>