123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <class name="TileMap" inherits="Node2D" category="Core" version="3.1">
- <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>
- <link>https://docs.godotengine.org/en/latest/tutorials/2d/using_tilemaps.html</link>
- </tutorials>
- <demos>
- </demos>
- <methods>
- <method name="clear">
- <return type="void">
- </return>
- <description>
- Clears all cells.
- </description>
- </method>
- <method name="fix_invalid_tiles">
- <return type="void">
- </return>
- <description>
- Clears cells that do not exist in the tileset.
- </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>
- Returns the tile index of the given cell.
- </description>
- </method>
- <method name="get_cell_autotile_coord" qualifiers="const">
- <return type="Vector2">
- </return>
- <argument index="0" name="x" type="int">
- </argument>
- <argument index="1" name="y" type="int">
- </argument>
- <description>
- </description>
- </method>
- <method name="get_cellv" qualifiers="const">
- <return type="int">
- </return>
- <argument index="0" name="position" type="Vector2">
- </argument>
- <description>
- Returns the tile index of the cell given by a Vector2.
- </description>
- </method>
- <method name="get_collision_layer_bit" qualifiers="const">
- <return type="bool">
- </return>
- <argument index="0" name="bit" type="int">
- </argument>
- <description>
- Returns [code]true[/code] if the given collision layer bit is set.
- </description>
- </method>
- <method name="get_collision_mask_bit" qualifiers="const">
- <return type="bool">
- </return>
- <argument index="0" name="bit" type="int">
- </argument>
- <description>
- Returns [code]true[/code] if the given collision mask bit is set.
- </description>
- </method>
- <method name="get_used_cells" qualifiers="const">
- <return type="Array">
- </return>
- <description>
- Returns a [Vector2] array with the positions of all cells containing a tile from the tileset (i.e. a tile index different from [code]-1[/code]).
- </description>
- </method>
- <method name="get_used_cells_by_id" qualifiers="const">
- <return type="Array">
- </return>
- <argument index="0" name="id" type="int">
- </argument>
- <description>
- Returns an array of all cells with the given tile id.
- </description>
- </method>
- <method name="get_used_rect">
- <return type="Rect2">
- </return>
- <description>
- Returns a rectangle enclosing the used (non-empty) tiles of the map.
- </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>
- Returns [code]true[/code] if the given cell is transposed, i.e. the x and y axes are swapped.
- </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>
- Returns [code]true[/code] if the given cell is flipped in 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>
- Returns [code]true[/code] if the given cell is flipped in the y axis.
- </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>
- Returns the global position corresponding to the given tilemap (grid-based) coordinates.
- Optionally, the tilemap's 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>
- Sets the tile index for the cell given by a Vector2.
- An index of [code]-1[/code] clears the cell.
- Optionally, the tile can also be flipped, transposed, or given autotile coordinates.
- Note that 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 [method update_dirty_quadrants].
- </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>
- Sets the tile index for the given cell.
- An index of [code]-1[/code] clears the cell.
- Optionally, the tile can also be flipped or transposed.
- Note that 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 [method update_dirty_quadrants].
- </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>
- Sets the given collision layer bit.
- </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>
- Sets the given collision mask bit.
- </description>
- </method>
- <method name="update_bitmask_area">
- <return type="void">
- </return>
- <argument index="0" name="position" type="Vector2">
- </argument>
- <description>
- Applies autotiling rules to the cell (and its adjacent cells) referenced by its grid-based x and y coordinates.
- </description>
- </method>
- <method name="update_bitmask_region">
- <return type="void">
- </return>
- <argument index="0" name="start" type="Vector2" default="Vector2( 0, 0 )">
- </argument>
- <argument index="1" name="end" type="Vector2" default="Vector2( 0, 0 )">
- </argument>
- <description>
- 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.
- </description>
- </method>
- <method name="update_dirty_quadrants">
- <return type="void">
- </return>
- <description>
- Updates the tile map's quadrants, allowing things such as navigation and collision shapes to be immediately used if modified.
- </description>
- </method>
- <method name="world_to_map" qualifiers="const">
- <return type="Vector2">
- </return>
- <argument index="0" name="world_position" type="Vector2">
- </argument>
- <description>
- Returns the tilemap (grid-based) coordinatescorresponding to the given global position.
- </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">
- Returned when a cell doesn't exist.
- </constant>
- <constant name="MODE_SQUARE" value="0" enum="Mode">
- Orthogonal orientation mode.
- </constant>
- <constant name="MODE_ISOMETRIC" value="1" enum="Mode">
- Isometric orientation mode.
- </constant>
- <constant name="MODE_CUSTOM" value="2" enum="Mode">
- Custom orientation mode.
- </constant>
- <constant name="HALF_OFFSET_X" value="0" enum="HalfOffset">
- Half offset on the X coordinate.
- </constant>
- <constant name="HALF_OFFSET_Y" value="1" enum="HalfOffset">
- Half offset on the Y coordinate.
- </constant>
- <constant name="HALF_OFFSET_DISABLED" value="2" enum="HalfOffset">
- Half offset disabled.
- </constant>
- <constant name="TILE_ORIGIN_TOP_LEFT" value="0" enum="TileOrigin">
- Tile origin at its top-left corner.
- </constant>
- <constant name="TILE_ORIGIN_CENTER" value="1" enum="TileOrigin">
- Tile origin at its center.
- </constant>
- <constant name="TILE_ORIGIN_BOTTOM_LEFT" value="2" enum="TileOrigin">
- Tile origin at its bottom-left corner.
- </constant>
- </constants>
- </class>
|