.. 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//doc_classes. .. _class_TileMap: TileMap ======= **Inherits:** :ref:`Node2D` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Category:** Core Brief Description ----------------- Node for 2D tile-based maps. Member Functions ---------------- +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear` **(** **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_cell` **(** :ref:`int` x, :ref:`int` y **)** const | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_cellv` **(** :ref:`Vector2` position **)** const | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_collision_layer_bit` **(** :ref:`int` bit **)** const | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_collision_mask_bit` **(** :ref:`int` bit **)** const | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_used_cells` **(** **)** const | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_used_cells_by_id` **(** :ref:`int` id **)** const | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`get_used_rect` **(** **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_cell_transposed` **(** :ref:`int` x, :ref:`int` y **)** const | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_cell_x_flipped` **(** :ref:`int` x, :ref:`int` y **)** const | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_cell_y_flipped` **(** :ref:`int` x, :ref:`int` y **)** const | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`map_to_world` **(** :ref:`Vector2` map_position, :ref:`bool` ignore_half_ofs=false **)** const | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_cell` **(** :ref:`int` x, :ref:`int` y, :ref:`int` tile, :ref:`bool` flip_x=false, :ref:`bool` flip_y=false, :ref:`bool` transpose=false, :ref:`Vector2` autotile_coord=Vector2( 0, 0 ) **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_cellv` **(** :ref:`Vector2` position, :ref:`int` tile, :ref:`bool` flip_x=false, :ref:`bool` flip_y=false, :ref:`bool` transpose=false **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_collision_layer_bit` **(** :ref:`int` bit, :ref:`bool` value **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_collision_mask_bit` **(** :ref:`int` bit, :ref:`bool` value **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`update_bitmask_area` **(** :ref:`Vector2` position **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`update_bitmask_region` **(** :ref:`Vector2` start=Vector2( 0, 0 ), :ref:`Vector2` end=Vector2( 0, 0 ) **)** | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`world_to_map` **(** :ref:`Vector2` world_position **)** const | +--------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Signals ------- .. _class_TileMap_settings_changed: - **settings_changed** **(** **)** Emitted when a tilemap setting has changed. Member Variables ---------------- .. _class_TileMap_cell_clip_uv: - :ref:`bool` **cell_clip_uv** .. _class_TileMap_cell_custom_transform: - :ref:`Transform2D` **cell_custom_transform** - The custom :ref:`Transform2D` to be applied to the TileMap's cells. .. _class_TileMap_cell_half_offset: - :ref:`HalfOffset` **cell_half_offset** - Amount to offset alternating tiles. Uses HALF_OFFSET\_\* constants. Default value: HALF_OFFSET_DISABLED. .. _class_TileMap_cell_quadrant_size: - :ref:`int` **cell_quadrant_size** - The TileMap's quadrant size. Optimizes drawing by batching, using chunks of this size. Default value: 16. .. _class_TileMap_cell_size: - :ref:`Vector2` **cell_size** - The TileMap's cell size. .. _class_TileMap_cell_tile_origin: - :ref:`TileOrigin` **cell_tile_origin** - Position for tile origin. Uses TILE_ORIGIN\_\* constants. Default value: TILE_ORIGIN_TOP_LEFT. .. _class_TileMap_cell_y_sort: - :ref:`bool` **cell_y_sort** - If ``true`` the TileMap's children will be drawn in order of their Y coordinate. Default value: ``false``. .. _class_TileMap_collision_bounce: - :ref:`float` **collision_bounce** - Bounce value for static body collisions (see ``collision_use_kinematic``). Default value: 0. .. _class_TileMap_collision_friction: - :ref:`float` **collision_friction** - Friction value for static body collisions (see ``collision_use_kinematic``). Default value: 1. .. _class_TileMap_collision_layer: - :ref:`int` **collision_layer** - The collision layer(s) for all colliders in the TileMap. .. _class_TileMap_collision_mask: - :ref:`int` **collision_mask** - The collision mask(s) for all colliders in the TileMap. .. _class_TileMap_collision_use_kinematic: - :ref:`bool` **collision_use_kinematic** - If ``true`` TileMap collisions will be handled as a kinematic body. If ``false`` collisions will be handled as static body. Default value: ``false``. .. _class_TileMap_mode: - :ref:`Mode` **mode** - The TileMap orientation mode. Uses MODE\_\* constants. Default value: MODE_SQUARE. .. _class_TileMap_occluder_light_mask: - :ref:`int` **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_tile_set: - :ref:`TileSet` **tile_set** - The assigned :ref:`TileSet`. Numeric Constants ----------------- - **INVALID_CELL** = **-1** --- Returned when a cell doesn't exist. Enums ----- .. _enum_TileMap_HalfOffset: 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. .. _enum_TileMap_TileOrigin: 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. .. _enum_TileMap_Mode: enum **Mode** - **MODE_SQUARE** = **0** --- Orthogonal orientation mode. - **MODE_ISOMETRIC** = **1** --- Isometric orientation mode. - **MODE_CUSTOM** = **2** --- Custom orientation mode. Description ----------- Node for 2D tile-based maps. Tilemaps use a :ref:`TileSet` which contain a list of tiles (textures plus optional collision, navigation, and/or occluder shapes) which are used to create grid-based maps. Member Function Description --------------------------- .. _class_TileMap_clear: - void **clear** **(** **)** Clear all cells. .. _class_TileMap_get_cell: - :ref:`int` **get_cell** **(** :ref:`int` x, :ref:`int` y **)** const Return the tile index of the referenced cell. .. _class_TileMap_get_cellv: - :ref:`int` **get_cellv** **(** :ref:`Vector2` position **)** const Return the tile index of the cell referenced by a Vector2. .. _class_TileMap_get_collision_layer_bit: - :ref:`bool` **get_collision_layer_bit** **(** :ref:`int` bit **)** const .. _class_TileMap_get_collision_mask_bit: - :ref:`bool` **get_collision_mask_bit** **(** :ref:`int` bit **)** const .. _class_TileMap_get_used_cells: - :ref:`Array` **get_used_cells** **(** **)** const Return an array of all cells containing a tile from the tileset (i.e. a tile index different from -1). .. _class_TileMap_get_used_cells_by_id: - :ref:`Array` **get_used_cells_by_id** **(** :ref:`int` id **)** const .. _class_TileMap_get_used_rect: - :ref:`Rect2` **get_used_rect** **(** **)** .. _class_TileMap_is_cell_transposed: - :ref:`bool` **is_cell_transposed** **(** :ref:`int` x, :ref:`int` y **)** const Return whether the referenced cell is transposed, i.e. the X and Y axes are swapped (mirroring with regard to the (1,1) vector). .. _class_TileMap_is_cell_x_flipped: - :ref:`bool` **is_cell_x_flipped** **(** :ref:`int` x, :ref:`int` y **)** const Return whether the referenced cell is flipped over the X axis. .. _class_TileMap_is_cell_y_flipped: - :ref:`bool` **is_cell_y_flipped** **(** :ref:`int` x, :ref:`int` y **)** const Return whether the referenced cell is flipped over the Y axis. .. _class_TileMap_map_to_world: - :ref:`Vector2` **map_to_world** **(** :ref:`Vector2` map_position, :ref:`bool` ignore_half_ofs=false **)** const 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. .. _class_TileMap_set_cell: - void **set_cell** **(** :ref:`int` x, :ref:`int` y, :ref:`int` tile, :ref:`bool` flip_x=false, :ref:`bool` flip_y=false, :ref:`bool` transpose=false, :ref:`Vector2` autotile_coord=Vector2( 0, 0 ) **)** 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. .. _class_TileMap_set_cellv: - void **set_cellv** **(** :ref:`Vector2` position, :ref:`int` tile, :ref:`bool` flip_x=false, :ref:`bool` flip_y=false, :ref:`bool` transpose=false **)** 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. .. _class_TileMap_set_collision_layer_bit: - void **set_collision_layer_bit** **(** :ref:`int` bit, :ref:`bool` value **)** Set any collision layer to be ``true`` or ``false``. .. _class_TileMap_set_collision_mask_bit: - void **set_collision_mask_bit** **(** :ref:`int` bit, :ref:`bool` value **)** .. _class_TileMap_update_bitmask_area: - void **update_bitmask_area** **(** :ref:`Vector2` position **)** Applies autotiling rules to the cell (and its adjacent cells) referenced by its grid-based X and Y coordinates. .. _class_TileMap_update_bitmask_region: - void **update_bitmask_region** **(** :ref:`Vector2` start=Vector2( 0, 0 ), :ref:`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_world_to_map: - :ref:`Vector2` **world_to_map** **(** :ref:`Vector2` world_position **)** const Return the tilemap (grid-based) coordinates corresponding to the absolute world position given as an argument.