.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _class_Node2D: Node2D ====== **Inherits:** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Inherited By:** :ref:`RemoteTransform2D`, :ref:`Joint2D`, :ref:`ParallaxLayer`, :ref:`Line2D`, :ref:`VisibilityNotifier2D`, :ref:`Navigation2D`, :ref:`CollisionPolygon2D`, :ref:`TouchScreenButton`, :ref:`Particles2D`, :ref:`AnimatedSprite`, :ref:`Light2D`, :ref:`Path2D`, :ref:`AudioStreamPlayer2D`, :ref:`Sprite`, :ref:`RayCast2D`, :ref:`CollisionShape2D`, :ref:`NavigationPolygonInstance`, :ref:`PathFollow2D`, :ref:`Polygon2D`, :ref:`Position2D`, :ref:`LightOccluder2D`, :ref:`CollisionObject2D`, :ref:`BackBufferCopy`, :ref:`CanvasModulate`, :ref:`YSort`, :ref:`TileMap`, :ref:`Camera2D` **Category:** Core Brief Description ----------------- Base node for 2D system. Member Functions ---------------- +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`edit_set_pivot` **(** :ref:`Vector2` pivot **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_angle_to` **(** :ref:`Vector2` point **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_global_pos` **(** **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_global_rot` **(** **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_global_rotd` **(** **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_global_scale` **(** **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_pos` **(** **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Matrix32` | :ref:`get_relative_transform_to_parent` **(** :ref:`Object` parent **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_rot` **(** **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_rotd` **(** **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_scale` **(** **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_z` **(** **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`global_translate` **(** :ref:`Vector2` offset **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_z_relative` **(** **)** const | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`look_at` **(** :ref:`Vector2` point **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`move_local_x` **(** :ref:`float` delta, :ref:`bool` scaled=false **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`move_local_y` **(** :ref:`float` delta, :ref:`bool` scaled=false **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`rotate` **(** :ref:`float` radians **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`scale` **(** :ref:`Vector2` ratio **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_global_pos` **(** :ref:`Vector2` pos **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_global_rot` **(** :ref:`float` radians **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_global_rotd` **(** :ref:`float` degrees **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_global_scale` **(** :ref:`Vector2` scale **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_global_transform` **(** :ref:`Matrix32` xform **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_pos` **(** :ref:`Vector2` pos **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_rot` **(** :ref:`float` radians **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_rotd` **(** :ref:`float` degrees **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_scale` **(** :ref:`Vector2` scale **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_transform` **(** :ref:`Matrix32` xform **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_z` **(** :ref:`int` z **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_z_as_relative` **(** :ref:`bool` enable **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`translate` **(** :ref:`Vector2` offset **)** | +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ Description ----------- Base node for 2D system. Node2D contains a position, rotation and scale, which is used to position and animate. It can alternatively be used with a custom 2D transform (:ref:`Transform2D`). A tree of Node2Ds allows complex hierarchies for animation and positioning. Member Function Description --------------------------- .. _class_Node2D_apply_scale: - void **apply_scale** **(** :ref:`Vector2` ratio **)** Apply the 'ratio' scale to the 2D node, according to its current scale value. .. _class_Node2D_edit_set_pivot: - void **edit_set_pivot** **(** :ref:`Vector2` pivot **)** Set the pivot position of the 2D node to 'pivot' value. This method is implemented only in some nodes that inherit Node2D. .. _class_Node2D_get_angle_to: - :ref:`float` **get_angle_to** **(** :ref:`Vector2` point **)** const Return the rotation angle in radians needed for the 2d node to point at 'point' position. .. _class_Node2D_get_global_position: - :ref:`Vector2` **get_global_position** **(** **)** const Return the global position of the 2D node. .. _class_Node2D_get_global_rot: - :ref:`float` **get_global_rot** **(** **)** const Return the global rotation in radians of the 2D node. .. _class_Node2D_get_global_rotd: - :ref:`float` **get_global_rotd** **(** **)** const Return the global rotation in degrees of the 2D node. .. _class_Node2D_get_global_scale: - :ref:`Vector2` **get_global_scale** **(** **)** const Return the global scale of the 2D node. .. _class_Node2D_get_pos: .. _class_Node2D_get_position: - :ref:`Vector2` **get_position** **(** **)** const Return the position of the 2D node. .. _class_Node2D_get_relative_transform_to_parent: - :ref:`Transform2D` **get_relative_transform_to_parent** **(** :ref:`Node` parent **)** const Return the transform :ref:`Transform2D` calculated relatively to the parent of this 2D node. .. _class_Node2D_get_rotation: - :ref:`float` **get_rotation** **(** **)** const Return the rotation in radians of the 2D node. .. _class_Node2D_get_rotation_in_degrees: - :ref:`float` **get_rotation_in_degrees** **(** **)** const Return the rotation in degrees of the 2D node. .. _class_Node2D_get_scale: - :ref:`Vector2` **get_scale** **(** **)** const Return the scale of the 2D node. .. _class_Node2D_get_z: - :ref:`int` **get_z** **(** **)** const Return the Z-index of the 2D node. .. _class_Node2D_global_translate: - void **global_translate** **(** :ref:`Vector2` offset **)** Apply a global translation of 'offset' to the 2D node, starting from its current global position. .. _class_Node2D_is_z_relative: - :ref:`bool` **is_z_relative** **(** **)** const Return true if the Z-index value of this 2D node is relative to its parent's. Else, return false. .. _class_Node2D_look_at: - void **look_at** **(** :ref:`Vector2` point **)** Rotate the 2d node so it points at 'point' position. .. _class_Node2D_move_local_x: - void **move_local_x** **(** :ref:`float` delta, :ref:`bool` scaled=null **)** Apply a local translation on X axis to the 2D node according to the 'delta' of the process. If 'scaled' is false, the movement is normalized. .. _class_Node2D_move_local_y: - void **move_local_y** **(** :ref:`float` delta, :ref:`bool` scaled=null **)** Apply a local translation on Y axis to the 2D node according to the 'delta' of the process. If 'scaled' is false, the movement is normalized. .. _class_Node2D_rotate: - void **rotate** **(** :ref:`float` radians **)** Apply a rotation (in radians) to the 2D node, starting from its current rotation. .. _class_Node2D_set_global_position: - void **set_global_position** **(** :ref:`Vector2` pos **)** Set the global position of the 2D node. .. _class_Node2D_set_global_rotation: - void **set_global_rotation** **(** :ref:`float` radians **)** Set the global rotation in radians of the 2D node .. _class_Node2D_set_global_rotation_in_degrees: - void **set_global_rotation_in_degrees** **(** :ref:`float` degrees **)** Set the global rotation in degrees of the 2D node .. _class_Node2D_set_global_scale: - void **set_global_scale** **(** :ref:`Vector2` scale **)** Set the global scale of the 2D node. .. _class_Node2D_set_global_rot: - void **set_global_rot** **(** :ref:`float` radians **)** Set the global rotation in radians of the 2D node. .. _class_Node2D_set_global_rotd: - void **set_global_rotd** **(** :ref:`float` degrees **)** Set the global rotation in degrees of the 2D node. .. _class_Node2D_set_global_scale: - void **set_global_scale** **(** :ref:`Vector2` scale **)** Set the global scale of the 2D node. .. _class_Node2D_set_global_transform: - void **set_global_transform** **(** :ref:`Transform2D` xform **)** Set the global transform :ref:`Transform2D` of the 2D node. .. _class_Node2D_set_position: - void **set_position** **(** :ref:`Vector2` pos **)** Set the position of the 2D node. .. _class_Node2D_set_rotation: - void **set_rotation** **(** :ref:`float` radians **)** Set the rotation in radians of the 2D node. .. _class_Node2D_set_rotation_in_degrees: - void **set_rotation_in_degrees** **(** :ref:`float` degrees **)** Set the rotation in degrees of the 2D node. .. _class_Node2D_set_scale: - void **set_scale** **(** :ref:`Vector2` scale **)** Set the scale of the 2D node. .. _class_Node2D_set_transform: - void **set_transform** **(** :ref:`Transform2D` xform **)** Set the local transform :ref:`Transform2D` of the 2D node. .. _class_Node2D_set_z: - void **set_z** **(** :ref:`int` z **)** Set the Z-index value of the 2D node. .. _class_Node2D_set_z_as_relative: - void **set_z_as_relative** **(** :ref:`bool` enable **)** Set the Z-index value as relative to the parent node of this 2D node. Thus, if this 2D node's Z-index value is 2 and its parent's effective Z-index is 3, then the effective Z-index value of this 2D node would be 3 + 2 = 5. .. _class_Node2D_to_global: - :ref:`Vector2` **to_global** **(** :ref:`Vector2` local_point **)** const .. _class_Node2D_to_local: - :ref:`Vector2` **to_local** **(** :ref:`Vector2` global_point **)** const .. _class_Node2D_translate: - void **translate** **(** :ref:`Vector2` offset **)** Apply a local translation of 'offset' to the 2D node, starting from its current local position.