瀏覽代碼

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

Document TileMap class
Juan Linietsky 10 年之前
父節點
當前提交
f6957eb154
共有 1 個文件被更改,包括 52 次插入6 次删除
  1. 52 6
      doc/base/classes.xml

+ 52 - 6
doc/base/classes.xml

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