Files
godot-docs/classes/class_tilemap.rst
T

575 lines
37 KiB
ReStructuredText

.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
.. DO NOT EDIT THIS FILE, but the TileMap.xml source instead.
.. The source is found in doc/classes or modules/<name>/doc_classes.
.. _class_TileMap:
TileMap
=======
**Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
**Category:** Core
Brief Description
-----------------
Node for 2D tile-based maps.
Properties
----------
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`bool<class_bool>` | :ref:`cell_clip_uv<class_TileMap_property_cell_clip_uv>` | false |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`Transform2D<class_Transform2D>` | :ref:`cell_custom_transform<class_TileMap_property_cell_custom_transform>` | Transform2D( 1, 0, 0, 1, 0, 0 ) |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`HalfOffset<enum_TileMap_HalfOffset>` | :ref:`cell_half_offset<class_TileMap_property_cell_half_offset>` | 2 |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`int<class_int>` | :ref:`cell_quadrant_size<class_TileMap_property_cell_quadrant_size>` | 16 |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`cell_size<class_TileMap_property_cell_size>` | Vector2( 64, 64 ) |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`TileOrigin<enum_TileMap_TileOrigin>` | :ref:`cell_tile_origin<class_TileMap_property_cell_tile_origin>` | 0 |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`bool<class_bool>` | :ref:`cell_y_sort<class_TileMap_property_cell_y_sort>` | false |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`float<class_float>` | :ref:`collision_bounce<class_TileMap_property_collision_bounce>` | 0.0 |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`float<class_float>` | :ref:`collision_friction<class_TileMap_property_collision_friction>` | 1.0 |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`int<class_int>` | :ref:`collision_layer<class_TileMap_property_collision_layer>` | 1 |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`int<class_int>` | :ref:`collision_mask<class_TileMap_property_collision_mask>` | 1 |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`bool<class_bool>` | :ref:`collision_use_kinematic<class_TileMap_property_collision_use_kinematic>` | false |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`bool<class_bool>` | :ref:`collision_use_parent<class_TileMap_property_collision_use_parent>` | false |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`Mode<enum_TileMap_Mode>` | :ref:`mode<class_TileMap_property_mode>` | 0 |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`int<class_int>` | :ref:`occluder_light_mask<class_TileMap_property_occluder_light_mask>` | 1 |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
| :ref:`TileSet<class_TileSet>` | :ref:`tile_set<class_TileMap_property_tile_set>` | null |
+--------------------------------------------+--------------------------------------------------------------------------------+---------------------------------+
Methods
-------
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`clear<class_TileMap_method_clear>` **(** **)** |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`fix_invalid_tiles<class_TileMap_method_fix_invalid_tiles>` **(** **)** |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_cell<class_TileMap_method_get_cell>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`get_cell_autotile_coord<class_TileMap_method_get_cell_autotile_coord>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_cellv<class_TileMap_method_get_cellv>` **(** :ref:`Vector2<class_Vector2>` position **)** const |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`get_collision_layer_bit<class_TileMap_method_get_collision_layer_bit>` **(** :ref:`int<class_int>` bit **)** const |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`get_collision_mask_bit<class_TileMap_method_get_collision_mask_bit>` **(** :ref:`int<class_int>` bit **)** const |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`get_used_cells<class_TileMap_method_get_used_cells>` **(** **)** const |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`get_used_cells_by_id<class_TileMap_method_get_used_cells_by_id>` **(** :ref:`int<class_int>` id **)** const |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Rect2<class_Rect2>` | :ref:`get_used_rect<class_TileMap_method_get_used_rect>` **(** **)** |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_cell_transposed<class_TileMap_method_is_cell_transposed>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_cell_x_flipped<class_TileMap_method_is_cell_x_flipped>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_cell_y_flipped<class_TileMap_method_is_cell_y_flipped>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`map_to_world<class_TileMap_method_map_to_world>` **(** :ref:`Vector2<class_Vector2>` map_position, :ref:`bool<class_bool>` ignore_half_ofs=false **)** const |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_cell<class_TileMap_method_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, :ref:`Vector2<class_Vector2>` autotile_coord=Vector2( 0, 0 ) **)** |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_cellv<class_TileMap_method_set_cellv>` **(** :ref:`Vector2<class_Vector2>` position, :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 **)** |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_collision_layer_bit<class_TileMap_method_set_collision_layer_bit>` **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)** |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_collision_mask_bit<class_TileMap_method_set_collision_mask_bit>` **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)** |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`update_bitmask_area<class_TileMap_method_update_bitmask_area>` **(** :ref:`Vector2<class_Vector2>` position **)** |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`update_bitmask_region<class_TileMap_method_update_bitmask_region>` **(** :ref:`Vector2<class_Vector2>` start=Vector2( 0, 0 ), :ref:`Vector2<class_Vector2>` end=Vector2( 0, 0 ) **)** |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`update_dirty_quadrants<class_TileMap_method_update_dirty_quadrants>` **(** **)** |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`world_to_map<class_TileMap_method_world_to_map>` **(** :ref:`Vector2<class_Vector2>` world_position **)** const |
+-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Signals
-------
.. _class_TileMap_signal_settings_changed:
- **settings_changed** **(** **)**
Emitted when a tilemap setting has changed.
Enumerations
------------
.. _enum_TileMap_Mode:
.. _class_TileMap_constant_MODE_SQUARE:
.. _class_TileMap_constant_MODE_ISOMETRIC:
.. _class_TileMap_constant_MODE_CUSTOM:
enum **Mode**:
- **MODE_SQUARE** = **0** --- Orthogonal orientation mode.
- **MODE_ISOMETRIC** = **1** --- Isometric orientation mode.
- **MODE_CUSTOM** = **2** --- Custom orientation mode.
.. _enum_TileMap_HalfOffset:
.. _class_TileMap_constant_HALF_OFFSET_X:
.. _class_TileMap_constant_HALF_OFFSET_Y:
.. _class_TileMap_constant_HALF_OFFSET_DISABLED:
.. _class_TileMap_constant_HALF_OFFSET_NEGATIVE_X:
.. _class_TileMap_constant_HALF_OFFSET_NEGATIVE_Y:
enum **HalfOffset**:
- **HALF_OFFSET_X** = **0** --- Half offset on the X coordinate.
- **HALF_OFFSET_Y** = **1** --- Half offset on the Y coordinate.
- **HALF_OFFSET_DISABLED** = **2** --- Half offset disabled.
- **HALF_OFFSET_NEGATIVE_X** = **3** --- Half offset on the X coordinate (negative).
- **HALF_OFFSET_NEGATIVE_Y** = **4** --- Half offset on the Y coordinate (negative).
.. _enum_TileMap_TileOrigin:
.. _class_TileMap_constant_TILE_ORIGIN_TOP_LEFT:
.. _class_TileMap_constant_TILE_ORIGIN_CENTER:
.. _class_TileMap_constant_TILE_ORIGIN_BOTTOM_LEFT:
enum **TileOrigin**:
- **TILE_ORIGIN_TOP_LEFT** = **0** --- Tile origin at its top-left corner.
- **TILE_ORIGIN_CENTER** = **1** --- Tile origin at its center.
- **TILE_ORIGIN_BOTTOM_LEFT** = **2** --- Tile origin at its bottom-left corner.
Constants
---------
.. _class_TileMap_constant_INVALID_CELL:
- **INVALID_CELL** = **-1** --- Returned when a cell doesn't exist.
Description
-----------
Node for 2D tile-based maps. Tilemaps use a :ref:`TileSet<class_TileSet>` which contain a list of tiles (textures plus optional collision, navigation, and/or occluder shapes) which are used to create grid-based maps.
Tutorials
---------
- :doc:`../tutorials/2d/using_tilemaps`
Property Descriptions
---------------------
.. _class_TileMap_property_cell_clip_uv:
- :ref:`bool<class_bool>` **cell_clip_uv**
+-----------+--------------------+
| *Default* | false |
+-----------+--------------------+
| *Setter* | set_clip_uv(value) |
+-----------+--------------------+
| *Getter* | get_clip_uv() |
+-----------+--------------------+
.. _class_TileMap_property_cell_custom_transform:
- :ref:`Transform2D<class_Transform2D>` **cell_custom_transform**
+-----------+---------------------------------+
| *Default* | Transform2D( 1, 0, 0, 1, 0, 0 ) |
+-----------+---------------------------------+
| *Setter* | set_custom_transform(value) |
+-----------+---------------------------------+
| *Getter* | get_custom_transform() |
+-----------+---------------------------------+
The custom :ref:`Transform2D<class_Transform2D>` to be applied to the TileMap's cells.
.. _class_TileMap_property_cell_half_offset:
- :ref:`HalfOffset<enum_TileMap_HalfOffset>` **cell_half_offset**
+-----------+------------------------+
| *Default* | 2 |
+-----------+------------------------+
| *Setter* | set_half_offset(value) |
+-----------+------------------------+
| *Getter* | get_half_offset() |
+-----------+------------------------+
Amount to offset alternating tiles. See :ref:`HalfOffset<enum_TileMap_HalfOffset>` for possible values.
.. _class_TileMap_property_cell_quadrant_size:
- :ref:`int<class_int>` **cell_quadrant_size**
+-----------+--------------------------+
| *Default* | 16 |
+-----------+--------------------------+
| *Setter* | set_quadrant_size(value) |
+-----------+--------------------------+
| *Getter* | get_quadrant_size() |
+-----------+--------------------------+
The TileMap's quadrant size. Optimizes drawing by batching, using chunks of this size.
.. _class_TileMap_property_cell_size:
- :ref:`Vector2<class_Vector2>` **cell_size**
+-----------+----------------------+
| *Default* | Vector2( 64, 64 ) |
+-----------+----------------------+
| *Setter* | set_cell_size(value) |
+-----------+----------------------+
| *Getter* | get_cell_size() |
+-----------+----------------------+
The TileMap's cell size.
.. _class_TileMap_property_cell_tile_origin:
- :ref:`TileOrigin<enum_TileMap_TileOrigin>` **cell_tile_origin**
+-----------+------------------------+
| *Default* | 0 |
+-----------+------------------------+
| *Setter* | set_tile_origin(value) |
+-----------+------------------------+
| *Getter* | get_tile_origin() |
+-----------+------------------------+
Position for tile origin. See :ref:`TileOrigin<enum_TileMap_TileOrigin>` for possible values.
.. _class_TileMap_property_cell_y_sort:
- :ref:`bool<class_bool>` **cell_y_sort**
+-----------+--------------------------+
| *Default* | false |
+-----------+--------------------------+
| *Setter* | set_y_sort_mode(value) |
+-----------+--------------------------+
| *Getter* | is_y_sort_mode_enabled() |
+-----------+--------------------------+
If ``true``, the TileMap's children will be drawn in order of their Y coordinate.
.. _class_TileMap_property_collision_bounce:
- :ref:`float<class_float>` **collision_bounce**
+-----------+-----------------------------+
| *Default* | 0.0 |
+-----------+-----------------------------+
| *Setter* | set_collision_bounce(value) |
+-----------+-----------------------------+
| *Getter* | get_collision_bounce() |
+-----------+-----------------------------+
Bounce value for static body collisions (see ``collision_use_kinematic``).
.. _class_TileMap_property_collision_friction:
- :ref:`float<class_float>` **collision_friction**
+-----------+-------------------------------+
| *Default* | 1.0 |
+-----------+-------------------------------+
| *Setter* | set_collision_friction(value) |
+-----------+-------------------------------+
| *Getter* | get_collision_friction() |
+-----------+-------------------------------+
Friction value for static body collisions (see ``collision_use_kinematic``).
.. _class_TileMap_property_collision_layer:
- :ref:`int<class_int>` **collision_layer**
+-----------+----------------------------+
| *Default* | 1 |
+-----------+----------------------------+
| *Setter* | set_collision_layer(value) |
+-----------+----------------------------+
| *Getter* | get_collision_layer() |
+-----------+----------------------------+
The collision layer(s) for all colliders in the TileMap.
.. _class_TileMap_property_collision_mask:
- :ref:`int<class_int>` **collision_mask**
+-----------+---------------------------+
| *Default* | 1 |
+-----------+---------------------------+
| *Setter* | set_collision_mask(value) |
+-----------+---------------------------+
| *Getter* | get_collision_mask() |
+-----------+---------------------------+
The collision mask(s) for all colliders in the TileMap.
.. _class_TileMap_property_collision_use_kinematic:
- :ref:`bool<class_bool>` **collision_use_kinematic**
+-----------+------------------------------------+
| *Default* | false |
+-----------+------------------------------------+
| *Setter* | set_collision_use_kinematic(value) |
+-----------+------------------------------------+
| *Getter* | get_collision_use_kinematic() |
+-----------+------------------------------------+
If ``true``, TileMap collisions will be handled as a kinematic body. If ``false``, collisions will be handled as static body.
.. _class_TileMap_property_collision_use_parent:
- :ref:`bool<class_bool>` **collision_use_parent**
+-----------+---------------------------------+
| *Default* | false |
+-----------+---------------------------------+
| *Setter* | set_collision_use_parent(value) |
+-----------+---------------------------------+
| *Getter* | get_collision_use_parent() |
+-----------+---------------------------------+
.. _class_TileMap_property_mode:
- :ref:`Mode<enum_TileMap_Mode>` **mode**
+-----------+-----------------+
| *Default* | 0 |
+-----------+-----------------+
| *Setter* | set_mode(value) |
+-----------+-----------------+
| *Getter* | get_mode() |
+-----------+-----------------+
The TileMap orientation mode. See :ref:`Mode<enum_TileMap_Mode>` for possible values.
.. _class_TileMap_property_occluder_light_mask:
- :ref:`int<class_int>` **occluder_light_mask**
+-----------+--------------------------------+
| *Default* | 1 |
+-----------+--------------------------------+
| *Setter* | set_occluder_light_mask(value) |
+-----------+--------------------------------+
| *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).
.. _class_TileMap_property_tile_set:
- :ref:`TileSet<class_TileSet>` **tile_set**
+-----------+--------------------+
| *Default* | null |
+-----------+--------------------+
| *Setter* | set_tileset(value) |
+-----------+--------------------+
| *Getter* | get_tileset() |
+-----------+--------------------+
The assigned :ref:`TileSet<class_TileSet>`.
Method Descriptions
-------------------
.. _class_TileMap_method_clear:
- void **clear** **(** **)**
Clears all cells.
.. _class_TileMap_method_fix_invalid_tiles:
- void **fix_invalid_tiles** **(** **)**
Clears cells that do not exist in the tileset.
.. _class_TileMap_method_get_cell:
- :ref:`int<class_int>` **get_cell** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const
Returns the tile index of the given cell. If no tile exists in the cell, returns :ref:`INVALID_CELL<class_TileMap_constant_INVALID_CELL>`.
.. _class_TileMap_method_get_cell_autotile_coord:
- :ref:`Vector2<class_Vector2>` **get_cell_autotile_coord** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const
.. _class_TileMap_method_get_cellv:
- :ref:`int<class_int>` **get_cellv** **(** :ref:`Vector2<class_Vector2>` position **)** const
Returns the tile index of the cell given by a Vector2. If no tile exists in the cell, returns :ref:`INVALID_CELL<class_TileMap_constant_INVALID_CELL>`.
.. _class_TileMap_method_get_collision_layer_bit:
- :ref:`bool<class_bool>` **get_collision_layer_bit** **(** :ref:`int<class_int>` bit **)** const
Returns ``true`` if the given collision layer bit is set.
.. _class_TileMap_method_get_collision_mask_bit:
- :ref:`bool<class_bool>` **get_collision_mask_bit** **(** :ref:`int<class_int>` bit **)** const
Returns ``true`` if the given collision mask bit is set.
.. _class_TileMap_method_get_used_cells:
- :ref:`Array<class_Array>` **get_used_cells** **(** **)** const
Returns a :ref:`Vector2<class_Vector2>` array with the positions of all cells containing a tile from the tileset (i.e. a tile index different from ``-1``).
.. _class_TileMap_method_get_used_cells_by_id:
- :ref:`Array<class_Array>` **get_used_cells_by_id** **(** :ref:`int<class_int>` id **)** const
Returns an array of all cells with the given tile ``id``.
.. _class_TileMap_method_get_used_rect:
- :ref:`Rect2<class_Rect2>` **get_used_rect** **(** **)**
Returns a rectangle enclosing the used (non-empty) tiles of the map.
.. _class_TileMap_method_is_cell_transposed:
- :ref:`bool<class_bool>` **is_cell_transposed** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const
Returns ``true`` if the given cell is transposed, i.e. the X and Y axes are swapped.
.. _class_TileMap_method_is_cell_x_flipped:
- :ref:`bool<class_bool>` **is_cell_x_flipped** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const
Returns ``true`` if the given cell is flipped in the X axis.
.. _class_TileMap_method_is_cell_y_flipped:
- :ref:`bool<class_bool>` **is_cell_y_flipped** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y **)** const
Returns ``true`` if the given cell is flipped in the Y axis.
.. _class_TileMap_method_map_to_world:
- :ref:`Vector2<class_Vector2>` **map_to_world** **(** :ref:`Vector2<class_Vector2>` map_position, :ref:`bool<class_bool>` ignore_half_ofs=false **)** const
Returns the global position corresponding to the given tilemap (grid-based) coordinates.
Optionally, the tilemap's half offset can be ignored.
.. _class_TileMap_method_set_cell:
- 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, :ref:`Vector2<class_Vector2>` autotile_coord=Vector2( 0, 0 ) **)**
Sets the tile index for the cell given by a Vector2.
An index of ``-1`` clears the cell.
Optionally, the tile can also be flipped, transposed, or given autotile coordinates.
**Note:** Data such as navigation polygons and collision shapes are not immediately updated for performance reasons.
If you need these to be immediately updated, you can call :ref:`update_dirty_quadrants<class_TileMap_method_update_dirty_quadrants>`.
Overriding this method also overrides it internally, allowing custom logic to be implemented when tiles are placed/removed:
::
func set_cell(x, y, tile, flip_x, flip_y, transpose, autotile_coord)
# Write your custom logic here.
# To call the default method:
.set_cell(x, y, tile, flip_x, flip_y, transpose, autotile_coord)
.. _class_TileMap_method_set_cellv:
- void **set_cellv** **(** :ref:`Vector2<class_Vector2>` position, :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 **)**
Sets the tile index for the given cell.
An index of ``-1`` clears the cell.
Optionally, the tile can also be flipped or transposed.
**Note:** Data such as navigation polygons and collision shapes are not immediately updated for performance reasons.
If you need these to be immediately updated, you can call :ref:`update_dirty_quadrants<class_TileMap_method_update_dirty_quadrants>`.
.. _class_TileMap_method_set_collision_layer_bit:
- void **set_collision_layer_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
Sets the given collision layer bit.
.. _class_TileMap_method_set_collision_mask_bit:
- void **set_collision_mask_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
Sets the given collision mask bit.
.. _class_TileMap_method_update_bitmask_area:
- void **update_bitmask_area** **(** :ref:`Vector2<class_Vector2>` position **)**
Applies autotiling rules to the cell (and its adjacent cells) referenced by its grid-based X and Y coordinates.
.. _class_TileMap_method_update_bitmask_region:
- void **update_bitmask_region** **(** :ref:`Vector2<class_Vector2>` start=Vector2( 0, 0 ), :ref:`Vector2<class_Vector2>` end=Vector2( 0, 0 ) **)**
Applies autotiling rules to the cells in the given region (specified by grid-based X and Y coordinates).
Calling with invalid (or missing) parameters applies autotiling rules for the entire tilemap.
.. _class_TileMap_method_update_dirty_quadrants:
- void **update_dirty_quadrants** **(** **)**
Updates the tile map's quadrants, allowing things such as navigation and collision shapes to be immediately used if modified.
.. _class_TileMap_method_world_to_map:
- :ref:`Vector2<class_Vector2>` **world_to_map** **(** :ref:`Vector2<class_Vector2>` world_position **)** const
Returns the tilemap (grid-based) coordinates corresponding to the given local position.