godot/doc/classes/Node2D.xml
Hugo Locurcio f7f6115f76
Proofread and improve the whole class reference
- Document a few more properties and methods
- Add more information to many classes
- Fix lots of typos and gramar mistakes
- Use [code] tags for parameters consistently
- Use [b] and [i] tags consistently
- Put "Warning:" and "Note:" on their own line to be more visible,
  and make them always bold
- Tweak formatting in code examples to be more readable
- Use double quotes consistently
- Add more links to third-party technologies
2019-06-27 22:30:19 +02:00

158 lines
5.9 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<class name="Node2D" inherits="CanvasItem" category="Core" version="3.2">
<brief_description>
A 2D game object, parent of all 2D-related nodes. Has a position, rotation, scale and Z index.
</brief_description>
<description>
A 2D game object, with a position, rotation and scale. All 2D physics nodes and sprites inherit from Node2D. Use Node2D as a parent node to move, scale and rotate children in a 2D project. Also gives control on the node's render order.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/2d/custom_drawing_in_2d.html</link>
</tutorials>
<methods>
<method name="apply_scale">
<return type="void">
</return>
<argument index="0" name="ratio" type="Vector2">
</argument>
<description>
Multiplies the current scale by the [code]ratio[/code] vector.
</description>
</method>
<method name="get_angle_to" qualifiers="const">
<return type="float">
</return>
<argument index="0" name="point" type="Vector2">
</argument>
<description>
Returns the angle between the node and the [code]point[/code] in radians.
</description>
</method>
<method name="get_relative_transform_to_parent" qualifiers="const">
<return type="Transform2D">
</return>
<argument index="0" name="parent" type="Node">
</argument>
<description>
Returns the [Transform2D] relative to this node's parent.
</description>
</method>
<method name="global_translate">
<return type="void">
</return>
<argument index="0" name="offset" type="Vector2">
</argument>
<description>
Adds the [code]offset[/code] vector to the node's global position.
</description>
</method>
<method name="look_at">
<return type="void">
</return>
<argument index="0" name="point" type="Vector2">
</argument>
<description>
Rotates the node so it points towards the [code]point[/code].
</description>
</method>
<method name="move_local_x">
<return type="void">
</return>
<argument index="0" name="delta" type="float">
</argument>
<argument index="1" name="scaled" type="bool" default="false">
</argument>
<description>
Applies a local translation on the node's X axis based on the [method Node._process]'s [code]delta[/code]. If [code]scaled[/code] is [code]false[/code], normalizes the movement.
</description>
</method>
<method name="move_local_y">
<return type="void">
</return>
<argument index="0" name="delta" type="float">
</argument>
<argument index="1" name="scaled" type="bool" default="false">
</argument>
<description>
Applies a local translation on the node's Y axis based on the [method Node._process]'s [code]delta[/code]. If [code]scaled[/code] is [code]false[/code], normalizes the movement.
</description>
</method>
<method name="rotate">
<return type="void">
</return>
<argument index="0" name="radians" type="float">
</argument>
<description>
Applies a rotation to the node, in radians, starting from its current rotation.
</description>
</method>
<method name="to_global" qualifiers="const">
<return type="Vector2">
</return>
<argument index="0" name="local_point" type="Vector2">
</argument>
<description>
Converts a local point's coordinates to global coordinates.
</description>
</method>
<method name="to_local" qualifiers="const">
<return type="Vector2">
</return>
<argument index="0" name="global_point" type="Vector2">
</argument>
<description>
Converts a global point's coordinates to local coordinates.
</description>
</method>
<method name="translate">
<return type="void">
</return>
<argument index="0" name="offset" type="Vector2">
</argument>
<description>
Translates the node by the given [code]offset[/code] in local coordinates.
</description>
</method>
</methods>
<members>
<member name="global_position" type="Vector2" setter="set_global_position" getter="get_global_position">
Global position.
</member>
<member name="global_rotation" type="float" setter="set_global_rotation" getter="get_global_rotation">
Global rotation in radians.
</member>
<member name="global_rotation_degrees" type="float" setter="set_global_rotation_degrees" getter="get_global_rotation_degrees">
Global rotation in degrees.
</member>
<member name="global_scale" type="Vector2" setter="set_global_scale" getter="get_global_scale">
Global scale.
</member>
<member name="global_transform" type="Transform2D" setter="set_global_transform" getter="get_global_transform">
Global [Transform2D].
</member>
<member name="position" type="Vector2" setter="set_position" getter="get_position">
Position, relative to the node's parent.
</member>
<member name="rotation" type="float" setter="set_rotation" getter="get_rotation">
Rotation in radians, relative to the node's parent.
</member>
<member name="rotation_degrees" type="float" setter="set_rotation_degrees" getter="get_rotation_degrees">
Rotation in degrees, relative to the node's parent.
</member>
<member name="scale" type="Vector2" setter="set_scale" getter="get_scale">
The node's scale. Unscaled value: [code](1, 1)[/code].
</member>
<member name="transform" type="Transform2D" setter="set_transform" getter="get_transform">
Local [Transform2D].
</member>
<member name="z_as_relative" type="bool" setter="set_z_as_relative" getter="is_z_relative">
If [code]true[/code], the node's Z index is relative to its parent's Z index. If this node's Z index is 2 and its parent's effective Z index is 3, then this node's effective Z index will be 2 + 3 = 5.
</member>
<member name="z_index" type="int" setter="set_z_index" getter="get_z_index">
Z index. Controls the order in which the nodes render. A node with a higher Z index will display in front of others.
</member>
</members>
<constants>
</constants>
</class>