diff options
Diffstat (limited to 'doc/classes/TileMap.xml')
-rw-r--r-- | doc/classes/TileMap.xml | 362 |
1 files changed, 109 insertions, 253 deletions
diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index a12ef614e3..e92a7331e6 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -17,352 +17,208 @@ <link title="2D Kinematic Character Demo">https://godotengine.org/asset-library/asset/113</link> </tutorials> <methods> + <method name="add_layer"> + <return type="void" /> + <argument index="0" name="arg0" type="int" /> + <description> + </description> + </method> <method name="clear"> - <return type="void"> - </return> + <return type="void" /> <description> Clears all cells. </description> </method> <method name="fix_invalid_tiles"> - <return type="void"> - </return> + <return type="void" /> <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> + <method name="get_cell_alternative_tile" qualifiers="const"> + <return type="int" /> + <argument index="0" name="layer" type="int" /> + <argument index="1" name="coords" type="Vector2i" /> + <argument index="2" name="use_proxies" type="bool" /> <description> - Returns the tile index of the given cell. If no tile exists in the cell, returns [constant INVALID_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> + <method name="get_cell_atlas_coords" qualifiers="const"> + <return type="Vector2i" /> + <argument index="0" name="layer" type="int" /> + <argument index="1" name="coords" type="Vector2i" /> + <argument index="2" name="use_proxies" type="bool" /> <description> - Returns the coordinate (subtile column and row) of the autotile variation in the tileset. Returns a zero vector if the cell doesn't have autotiling. </description> </method> - <method name="get_cellv" qualifiers="const"> - <return type="int"> - </return> - <argument index="0" name="position" type="Vector2"> - </argument> + <method name="get_cell_source_id" qualifiers="const"> + <return type="int" /> + <argument index="0" name="layer" type="int" /> + <argument index="1" name="coords" type="Vector2i" /> + <argument index="2" name="use_proxies" type="bool" /> <description> - Returns the tile index of the cell given by a Vector2. If no tile exists in the cell, returns [constant INVALID_CELL]. </description> </method> - <method name="get_collision_layer_bit" qualifiers="const"> - <return type="bool"> - </return> - <argument index="0" name="bit" type="int"> - </argument> + <method name="get_layer_name" qualifiers="const"> + <return type="String" /> + <argument index="0" name="layer" type="int" /> <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> + <method name="get_layer_y_sort_origin" qualifiers="const"> + <return type="int" /> + <argument index="0" name="layer" type="int" /> <description> - Returns [code]true[/code] if the given collision mask bit is set. </description> </method> - <method name="get_used_cells" qualifiers="const"> - <return type="Vector2i[]"> - </return> + <method name="get_layer_z_indexd" qualifiers="const"> + <return type="int" /> + <argument index="0" name="layer" type="int" /> <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_index" qualifiers="const"> - <return type="Vector2i[]"> - </return> - <argument index="0" name="index" type="int"> - </argument> + <method name="get_layers_count" qualifiers="const"> + <return type="int" /> <description> - Returns an array of all cells with the given tile [code]index[/code]. </description> </method> - <method name="get_used_rect"> - <return type="Rect2"> - </return> + <method name="get_neighbor_cell" qualifiers="const"> + <return type="Vector2i" /> + <argument index="0" name="coords" type="Vector2i" /> + <argument index="1" name="neighbor" type="int" enum="TileSet.CellNeighbor" /> <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> + <method name="get_surrounding_tiles"> + <return type="Vector2i[]" /> + <argument index="0" name="coords" type="Vector2i" /> <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> + <method name="get_used_cells" qualifiers="const"> + <return type="Vector2i[]" /> + <argument index="0" name="layer" type="int" /> <description> - Returns [code]true[/code] if the given cell is flipped in the X axis. + 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="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> + <method name="get_used_rect"> + <return type="Rect2" /> + <description> + Returns a rectangle enclosing the used (non-empty) tiles of the map. + </description> + </method> + <method name="is_layer_enabled" qualifiers="const"> + <return type="bool" /> + <argument index="0" name="layer" type="int" /> + <description> + </description> + </method> + <method name="is_layer_y_sort_enabled" qualifiers="const"> + <return type="bool" /> + <argument index="0" name="layer" type="int" /> <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> + <return type="Vector2" /> + <argument index="0" name="map_position" type="Vector2i" /> <description> Returns the local 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> + <method name="move_layer"> + <return type="void" /> + <argument index="0" name="arg0" type="int" /> + <argument index="1" name="arg1" type="int" /> <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. The autotile coordinate refers to the column and row of the subtile. - [b]Note:[/b] 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]. - Overriding this method also overrides it internally, allowing custom logic to be implemented when tiles are placed/removed: - [codeblock] - func set_cell(x, y, tile, flip_x=false, flip_y=false, transpose=false, autotile_coord=Vector2()) - # Write your custom logic here. - # To call the default method: - .set_cell(x, y, tile, flip_x, flip_y, transpose, autotile_coord) - [/codeblock] </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> + <method name="remove_layer"> + <return type="void" /> + <argument index="0" name="arg0" type="int" /> <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. - [b]Note:[/b] 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> + <method name="set_cell"> + <return type="void" /> + <argument index="0" name="layer" type="int" /> + <argument index="1" name="coords" type="Vector2i" /> + <argument index="2" name="source_id" type="int" default="-1" /> + <argument index="3" name="atlas_coords" type="Vector2i" default="Vector2i(-1, -1)" /> + <argument index="4" name="alternative_tile" type="int" default="-1" /> <description> - Sets the given collision layer bit. + Sets the tile index for the cell given by a Vector2i. </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> + <method name="set_layer_enabled"> + <return type="void" /> + <argument index="0" name="layer" type="int" /> + <argument index="1" name="enabled" type="bool" /> <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> + <method name="set_layer_name"> + <return type="void" /> + <argument index="0" name="layer" type="int" /> + <argument index="1" name="name" type="String" /> <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> + <method name="set_layer_y_sort_enabled"> + <return type="void" /> + <argument index="0" name="layer" type="int" /> + <argument index="1" name="y_sort_enabled" type="bool" /> <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> + <method name="set_layer_y_sort_origin"> + <return type="void" /> + <argument index="0" name="layer" type="int" /> + <argument index="1" name="y_sort_origin" type="int" /> + <description> + </description> + </method> + <method name="set_layer_z_index"> + <return type="void" /> + <argument index="0" name="layer" type="int" /> + <argument index="1" name="z_index" type="int" /> <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> + <return type="Vector2i" /> + <argument index="0" name="world_position" type="Vector2" /> <description> Returns the tilemap (grid-based) coordinates corresponding to the given local position. </description> </method> </methods> <members> - <member name="cell_clip_uv" type="bool" setter="set_clip_uv" getter="get_clip_uv" default="false"> - If [code]true[/code], the cell's UVs will be clipped. - </member> - <member name="cell_custom_transform" type="Transform2D" setter="set_custom_transform" getter="get_custom_transform" default="Transform2D( 64, 0, 0, 64, 0, 0 )"> - 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" default="2"> - Amount to offset alternating tiles. See [enum HalfOffset] for possible values. - </member> <member name="cell_quadrant_size" type="int" setter="set_quadrant_size" getter="get_quadrant_size" default="16"> The TileMap's quadrant size. Optimizes drawing by batching, using chunks of this size. </member> - <member name="cell_size" type="Vector2" setter="set_cell_size" getter="get_cell_size" default="Vector2( 64, 64 )"> - The TileMap's cell size. - </member> - <member name="cell_tile_origin" type="int" setter="set_tile_origin" getter="get_tile_origin" enum="TileMap.TileOrigin" default="0"> - Position for tile origin. See [enum TileOrigin] for possible values. - </member> - <member name="cell_y_sort" type="bool" setter="set_y_sort_enabled" getter="is_y_sort_enabled" default="false"> - If [code]true[/code], the TileMap's direct children will be drawn in order of their Y coordinate. - </member> - <member name="centered_textures" type="bool" setter="set_centered_textures" getter="is_centered_textures_enabled" default="false"> - If [code]true[/code], the textures will be centered in the middle of each tile. This is useful for certain isometric or top-down modes when textures are made larger or smaller than the tiles (e.g. to avoid flickering on tile edges). The offset is still applied, but from the center of the tile. If used, [member compatibility_mode] is ignored. - If [code]false[/code], the texture position start in the top-left corner unless [member compatibility_mode] is enabled. - </member> - <member name="collision_bounce" type="float" setter="set_collision_bounce" getter="get_collision_bounce" default="0.0"> - Bounce value for static body collisions (see [code]collision_use_kinematic[/code]). - </member> - <member name="collision_friction" type="float" setter="set_collision_friction" getter="get_collision_friction" default="1.0"> - Friction value for static body collisions (see [code]collision_use_kinematic[/code]). - </member> - <member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer" default="1"> - The collision layer(s) for all colliders in the TileMap. See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information. - </member> - <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="1"> - The collision mask(s) for all colliders in the TileMap. See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information. - </member> - <member name="collision_use_kinematic" type="bool" setter="set_collision_use_kinematic" getter="get_collision_use_kinematic" default="false"> - If [code]true[/code], TileMap collisions will be handled as a kinematic body. If [code]false[/code], collisions will be handled as static body. - </member> - <member name="collision_use_parent" type="bool" setter="set_collision_use_parent" getter="get_collision_use_parent" default="false"> - If [code]true[/code], this tilemap's collision shape will be added to the collision shape of the parent. The parent has to be a [CollisionObject2D]. + <member name="collision_visibility_mode" type="int" setter="set_collision_visibility_mode" getter="get_collision_visibility_mode" enum="TileMap.VisibilityMode" default="0"> </member> - <member name="compatibility_mode" type="bool" setter="set_compatibility_mode" getter="is_compatibility_mode_enabled" default="false"> - If [code]true[/code], the compatibility with the tilemaps made in Godot 3.1 or earlier is maintained (textures move when the tile origin changes and rotate if the texture size is not homogeneous). This mode presents problems when doing [code]flip_h[/code], [code]flip_v[/code] and [code]transpose[/code] tile operations on non-homogeneous isometric tiles (e.g. 2:1), in which the texture could not coincide with the collision, thus it is not recommended for isometric or non-square tiles. - If [code]false[/code], the textures do not move when doing [code]flip_h[/code], [code]flip_v[/code] operations if no offset is used, nor when changing the tile origin. - The compatibility mode doesn't work with the [member centered_textures] option, because displacing textures with the [member cell_tile_origin] option or in irregular tiles is not relevant when centering those textures. - </member> - <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="TileMap.Mode" default="0"> - The TileMap orientation mode. See [enum Mode] for possible values. - </member> - <member name="occluder_light_mask" type="int" setter="set_occluder_light_mask" getter="get_occluder_light_mask" default="1"> - 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 name="navigation_visibility_mode" type="int" setter="set_navigation_visibility_mode" getter="get_navigation_visibility_mode" enum="TileMap.VisibilityMode" default="0"> </member> <member name="tile_set" type="TileSet" setter="set_tileset" getter="get_tileset"> The assigned [TileSet]. </member> </members> <signals> - <signal name="settings_changed"> + <signal name="changed"> <description> - Emitted when a tilemap setting has changed. + Emitted when the [TileSet] of this TileMap changes. </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="HALF_OFFSET_NEGATIVE_X" value="3" enum="HalfOffset"> - Half offset on the X coordinate (negative). - </constant> - <constant name="HALF_OFFSET_NEGATIVE_Y" value="4" enum="HalfOffset"> - Half offset on the Y coordinate (negative). - </constant> - <constant name="TILE_ORIGIN_TOP_LEFT" value="0" enum="TileOrigin"> - Tile origin at its top-left corner. + <constant name="VISIBILITY_MODE_DEFAULT" value="0" enum="VisibilityMode"> </constant> - <constant name="TILE_ORIGIN_CENTER" value="1" enum="TileOrigin"> - Tile origin at its center. + <constant name="VISIBILITY_MODE_FORCE_HIDE" value="2" enum="VisibilityMode"> </constant> - <constant name="TILE_ORIGIN_BOTTOM_LEFT" value="2" enum="TileOrigin"> - Tile origin at its bottom-left corner. + <constant name="VISIBILITY_MODE_FORCE_SHOW" value="1" enum="VisibilityMode"> </constant> </constants> </class> |