Merge pull request #2514 from akien-mga/reference-edition

Document TileMap class
This commit is contained in:
Juan Linietsky 2015-09-24 18:05:10 -03:00
commit f6957eb154
1 changed files with 52 additions and 6 deletions

View File

@ -34362,10 +34362,10 @@
</class> </class>
<class name="TileMap" inherits="Node2D" category="Core"> <class name="TileMap" inherits="Node2D" category="Core">
<brief_description> <brief_description>
Node for 2D Tile-Based games. Node for 2D tile-based games.
</brief_description> </brief_description>
<description> <description>
Node for 2D Tile-Based games. Tilemaps use a TileSet which contain a list of tiles (textures, their rect and a collision) and are used to create complex grid-based maps. Node for 2D tile-based games. Tilemaps use a [TileSet] which contain a list of tiles (textures, their rect and a collision) and are used to create complex grid-based maps.
To optimize drawing and culling (sort of like [GridMap]), you can specify a quadrant size, so chunks of the map will be batched together at drawing time. To optimize drawing and culling (sort of like [GridMap]), you can specify a quadrant size, so chunks of the map will be batched together at drawing time.
</description> </description>
<methods> <methods>
@ -34387,36 +34387,43 @@
<argument index="0" name="mode" type="int"> <argument index="0" name="mode" type="int">
</argument> </argument>
<description> <description>
Set the orientation mode as square, isometric or custom (use MODE_* constants as argument).
</description> </description>
</method> </method>
<method name="get_mode" qualifiers="const"> <method name="get_mode" qualifiers="const">
<return type="int"> <return type="int">
</return> </return>
<description> <description>
Return the orientation mode.
</description> </description>
</method> </method>
<method name="set_half_offset"> <method name="set_half_offset">
<argument index="0" name="half_offset" type="int"> <argument index="0" name="half_offset" type="int">
</argument> </argument>
<description> <description>
Set an 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> </description>
</method> </method>
<method name="get_half_offset" qualifiers="const"> <method name="get_half_offset" qualifiers="const">
<return type="int"> <return type="int">
</return> </return>
<description> <description>
Return the current half offset configuration.
</description> </description>
</method> </method>
<method name="set_custom_transform"> <method name="set_custom_transform">
<argument index="0" name="custom_transform" type="Matrix32"> <argument index="0" name="custom_transform" type="Matrix32">
</argument> </argument>
<description> <description>
Set custom transform matrix, to use in combination with the custom orientation mode.
</description> </description>
</method> </method>
<method name="get_custom_transform" qualifiers="const"> <method name="get_custom_transform" qualifiers="const">
<return type="Matrix32"> <return type="Matrix32">
</return> </return>
<description> <description>
Return the custom transform matrix.
</description> </description>
</method> </method>
<method name="set_cell_size"> <method name="set_cell_size">
@ -34438,25 +34445,28 @@
</argument> </argument>
<description> <description>
Set the quadrant size, this optimizes drawing by batching chunks of map at draw/cull time. 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> </description>
</method> </method>
<method name="get_quadrant_size" qualifiers="const"> <method name="get_quadrant_size" qualifiers="const">
<return type="int"> <return type="int">
</return> </return>
<description> <description>
Return the quadrant size, this optimizes drawing by batching chunks of map at draw/cull time. Return the quadrant size.
</description> </description>
</method> </method>
<method name="set_tile_origin"> <method name="set_tile_origin">
<argument index="0" name="origin" type="int"> <argument index="0" name="origin" type="int">
</argument> </argument>
<description> <description>
Set the tile origin to the tile center or its top-left corner (use TILE_ORIGIN_* constants as argument).
</description> </description>
</method> </method>
<method name="get_tile_origin" qualifiers="const"> <method name="get_tile_origin" qualifiers="const">
<return type="int"> <return type="int">
</return> </return>
<description> <description>
Return the tile origin configuration.
</description> </description>
</method> </method>
<method name="set_center_x"> <method name="set_center_x">
@ -34491,72 +34501,89 @@
<argument index="0" name="enable" type="bool"> <argument index="0" name="enable" type="bool">
</argument> </argument>
<description> <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> </description>
</method> </method>
<method name="is_y_sort_mode_enabled" qualifiers="const"> <method name="is_y_sort_mode_enabled" qualifiers="const">
<return type="bool"> <return type="bool">
</return> </return>
<description> <description>
Return the Y sort mode.
</description> </description>
</method> </method>
<method name="set_collision_use_kinematic"> <method name="set_collision_use_kinematic">
<argument index="0" name="use_kinematic" type="bool"> <argument index="0" name="use_kinematic" type="bool">
</argument> </argument>
<description> <description>
Set the tilemap to handle collisions as a kinematic body (enabled) or a static body (disabled).
</description> </description>
</method> </method>
<method name="get_collision_use_kinematic" qualifiers="const"> <method name="get_collision_use_kinematic" qualifiers="const">
<return type="bool"> <return type="bool">
</return> </return>
<description> <description>
Return whether the tilemap handles collisions as a kinematic body.
</description> </description>
</method> </method>
<method name="set_collision_layer"> <method name="set_collision_layer">
<argument index="0" name="mask" type="int"> <argument index="0" name="mask" type="int">
</argument> </argument>
<description> <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> </description>
</method> </method>
<method name="get_collision_layer" qualifiers="const"> <method name="get_collision_layer" qualifiers="const">
<return type="int"> <return type="int">
</return> </return>
<description> <description>
Return the collision layer.
</description> </description>
</method> </method>
<method name="set_collision_mask"> <method name="set_collision_mask">
<argument index="0" name="mask" type="int"> <argument index="0" name="mask" type="int">
</argument> </argument>
<description> <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> </description>
</method> </method>
<method name="get_collision_mask" qualifiers="const"> <method name="get_collision_mask" qualifiers="const">
<return type="int"> <return type="int">
</return> </return>
<description> <description>
Return the collision mask.
</description> </description>
</method> </method>
<method name="set_collision_friction"> <method name="set_collision_friction">
<argument index="0" name="value" type="float"> <argument index="0" name="value" type="float">
</argument> </argument>
<description> <description>
Set the collision friction parameter.
Allowable values range from 0 to 1.
</description> </description>
</method> </method>
<method name="get_collision_friction" qualifiers="const"> <method name="get_collision_friction" qualifiers="const">
<return type="float"> <return type="float">
</return> </return>
<description> <description>
Return the collision friction parameter.
</description> </description>
</method> </method>
<method name="set_collision_bounce"> <method name="set_collision_bounce">
<argument index="0" name="value" type="float"> <argument index="0" name="value" type="float">
</argument> </argument>
<description> <description>
Set the collision bounce parameter.
Allowable values range from 0 to 1.
</description> </description>
</method> </method>
<method name="get_collision_bounce" qualifiers="const"> <method name="get_collision_bounce" qualifiers="const">
<return type="float"> <return type="float">
</return> </return>
<description> <description>
Return the collision bounce parameter.
</description> </description>
</method> </method>
<method name="set_cell"> <method name="set_cell">
@ -34573,6 +34600,9 @@
<argument index="5" name="transpose" type="bool" default="false"> <argument index="5" name="transpose" type="bool" default="false">
</argument> </argument>
<description> <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 or transposed.
</description> </description>
</method> </method>
<method name="set_cellv"> <method name="set_cellv">
@ -34587,6 +34617,9 @@
<argument index="4" name="transpose" type="bool" default="false"> <argument index="4" name="transpose" type="bool" default="false">
</argument> </argument>
<description> <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> </description>
</method> </method>
<method name="get_cell" qualifiers="const"> <method name="get_cell" qualifiers="const">
@ -34597,7 +34630,7 @@
<argument index="1" name="y" type="int"> <argument index="1" name="y" type="int">
</argument> </argument>
<description> <description>
Return the contents of a cell. Return the tile index of the referenced cell.
</description> </description>
</method> </method>
<method name="is_cell_x_flipped" qualifiers="const"> <method name="is_cell_x_flipped" qualifiers="const">
@ -34608,7 +34641,7 @@
<argument index="1" name="y" type="int"> <argument index="1" name="y" type="int">
</argument> </argument>
<description> <description>
Return if a given cell is flipped in x axis. Return whether the referenced cell is flipped over the X axis.
</description> </description>
</method> </method>
<method name="is_cell_y_flipped" qualifiers="const"> <method name="is_cell_y_flipped" qualifiers="const">
@ -34619,7 +34652,7 @@
<argument index="1" name="y" type="int"> <argument index="1" name="y" type="int">
</argument> </argument>
<description> <description>
Return if a given cell is flipped in y axis. Return whether the referenced cell is flipped over the Y axis.
</description> </description>
</method> </method>
<method name="clear"> <method name="clear">
@ -34631,6 +34664,7 @@
<return type="Array"> <return type="Array">
</return> </return>
<description> <description>
Return an array of all cells containing a tile from the tileset (i.e. a tile index different from -1).
</description> </description>
</method> </method>
<method name="map_to_world" qualifiers="const"> <method name="map_to_world" qualifiers="const">
@ -34641,6 +34675,8 @@
<argument index="1" name="ignore_half_ofs" type="bool" default="false"> <argument index="1" name="ignore_half_ofs" type="bool" default="false">
</argument> </argument>
<description> <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> </description>
</method> </method>
<method name="world_to_map" qualifiers="const"> <method name="world_to_map" qualifiers="const">
@ -34649,12 +34685,14 @@
<argument index="0" name="worldpos" type="Vector2"> <argument index="0" name="worldpos" type="Vector2">
</argument> </argument>
<description> <description>
Return the tilemap (grid-based) coordinates corresponding to the absolute world position given as an argument.
</description> </description>
</method> </method>
</methods> </methods>
<signals> <signals>
<signal name="settings_changed"> <signal name="settings_changed">
<description> <description>
Signal indicating that a tilemap setting has changed.
</description> </description>
</signal> </signal>
</signals> </signals>
@ -34663,20 +34701,28 @@
Returned when a cell doesn't exist. Returned when a cell doesn't exist.
</constant> </constant>
<constant name="MODE_SQUARE" value="0"> <constant name="MODE_SQUARE" value="0">
Orthogonal orientation mode.
</constant> </constant>
<constant name="MODE_ISOMETRIC" value="1"> <constant name="MODE_ISOMETRIC" value="1">
Isometric orientation mode.
</constant> </constant>
<constant name="MODE_CUSTOM" value="2"> <constant name="MODE_CUSTOM" value="2">
Custom orientation mode.
</constant> </constant>
<constant name="HALF_OFFSET_X" value="0"> <constant name="HALF_OFFSET_X" value="0">
Half offset on the X coordinate.
</constant> </constant>
<constant name="HALF_OFFSET_Y" value="1"> <constant name="HALF_OFFSET_Y" value="1">
Half offset on the Y coordinate.
</constant> </constant>
<constant name="HALF_OFFSET_DISABLED" value="2"> <constant name="HALF_OFFSET_DISABLED" value="2">
Half offset disabled.
</constant> </constant>
<constant name="TILE_ORIGIN_TOP_LEFT" value="0"> <constant name="TILE_ORIGIN_TOP_LEFT" value="0">
Tile origin at its top-left corner.
</constant> </constant>
<constant name="TILE_ORIGIN_CENTER" value="1"> <constant name="TILE_ORIGIN_CENTER" value="1">
Tile origin at its center.
</constant> </constant>
</constants> </constants>
</class> </class>