class_node2d.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_Node2D:
  4. Node2D
  5. ======
  6. **Inherits:** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Inherited By:** :ref:`RemoteTransform2D<class_remotetransform2d>`, :ref:`Joint2D<class_joint2d>`, :ref:`ParticleAttractor2D<class_particleattractor2d>`, :ref:`CollisionObject2D<class_collisionobject2d>`, :ref:`VisibilityNotifier2D<class_visibilitynotifier2d>`, :ref:`TileMap<class_tilemap>`, :ref:`Navigation2D<class_navigation2d>`, :ref:`CollisionPolygon2D<class_collisionpolygon2d>`, :ref:`TouchScreenButton<class_touchscreenbutton>`, :ref:`Particles2D<class_particles2d>`, :ref:`AnimatedSprite<class_animatedsprite>`, :ref:`Light2D<class_light2d>`, :ref:`SoundPlayer2D<class_soundplayer2d>`, :ref:`ViewportSprite<class_viewportsprite>`, :ref:`Path2D<class_path2d>`, :ref:`Sprite<class_sprite>`, :ref:`RayCast2D<class_raycast2d>`, :ref:`CollisionShape2D<class_collisionshape2d>`, :ref:`NavigationPolygonInstance<class_navigationpolygoninstance>`, :ref:`PathFollow2D<class_pathfollow2d>`, :ref:`ParallaxLayer<class_parallaxlayer>`, :ref:`Polygon2D<class_polygon2d>`, :ref:`Position2D<class_position2d>`, :ref:`LightOccluder2D<class_lightoccluder2d>`, :ref:`BackBufferCopy<class_backbuffercopy>`, :ref:`CanvasModulate<class_canvasmodulate>`, :ref:`YSort<class_ysort>`, :ref:`Camera2D<class_camera2d>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Base node for 2D system.
  12. Member Functions
  13. ----------------
  14. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`set_pos<class_Node2D_set_pos>` **(** :ref:`Vector2<class_vector2>` pos **)** |
  16. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`set_rot<class_Node2D_set_rot>` **(** :ref:`float<class_float>` rot **)** |
  18. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  19. | void | :ref:`set_scale<class_Node2D_set_scale>` **(** :ref:`Vector2<class_vector2>` scale **)** |
  20. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`Vector2<class_vector2>` | :ref:`get_pos<class_Node2D_get_pos>` **(** **)** const |
  22. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`float<class_float>` | :ref:`get_rot<class_Node2D_get_rot>` **(** **)** const |
  24. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Vector2<class_vector2>` | :ref:`get_scale<class_Node2D_get_scale>` **(** **)** const |
  26. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`rotate<class_Node2D_rotate>` **(** :ref:`float<class_float>` radians **)** |
  28. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`move_local_x<class_Node2D_move_local_x>` **(** :ref:`float<class_float>` delta, :ref:`bool<class_bool>` scaled=false **)** |
  30. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`move_local_y<class_Node2D_move_local_y>` **(** :ref:`float<class_float>` delta, :ref:`bool<class_bool>` scaled=false **)** |
  32. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`translate<class_Node2D_translate>` **(** :ref:`Vector2<class_vector2>` offset **)** |
  34. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`global_translate<class_Node2D_global_translate>` **(** :ref:`Vector2<class_vector2>` offset **)** |
  36. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`scale<class_Node2D_scale>` **(** :ref:`Vector2<class_vector2>` ratio **)** |
  38. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`set_global_pos<class_Node2D_set_global_pos>` **(** :ref:`Vector2<class_vector2>` pos **)** |
  40. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Vector2<class_vector2>` | :ref:`get_global_pos<class_Node2D_get_global_pos>` **(** **)** const |
  42. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`set_transform<class_Node2D_set_transform>` **(** :ref:`Matrix32<class_matrix32>` xform **)** |
  44. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  45. | void | :ref:`set_global_transform<class_Node2D_set_global_transform>` **(** :ref:`Matrix32<class_matrix32>` xform **)** |
  46. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  47. | void | :ref:`look_at<class_Node2D_look_at>` **(** :ref:`Vector2<class_vector2>` point **)** |
  48. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`float<class_float>` | :ref:`get_angle_to<class_Node2D_get_angle_to>` **(** :ref:`Vector2<class_vector2>` point **)** const |
  50. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  51. | void | :ref:`set_z<class_Node2D_set_z>` **(** :ref:`int<class_int>` z **)** |
  52. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`int<class_int>` | :ref:`get_z<class_Node2D_get_z>` **(** **)** const |
  54. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  55. | void | :ref:`set_z_as_relative<class_Node2D_set_z_as_relative>` **(** :ref:`bool<class_bool>` enable **)** |
  56. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`bool<class_bool>` | :ref:`is_z_relative<class_Node2D_is_z_relative>` **(** **)** const |
  58. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  59. | void | :ref:`edit_set_pivot<class_Node2D_edit_set_pivot>` **(** :ref:`Vector2<class_vector2>` pivot **)** |
  60. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`Matrix32<class_matrix32>` | :ref:`get_relative_transform_to_parent<class_Node2D_get_relative_transform_to_parent>` **(** :ref:`Object<class_object>` parent **)** const |
  62. +----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  63. Description
  64. -----------
  65. 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:`Matrix32<class_matrix32>`). A tree of Node2Ds allows complex hierarchies for animation and positioning.
  66. Member Function Description
  67. ---------------------------
  68. .. _class_Node2D_set_pos:
  69. - void **set_pos** **(** :ref:`Vector2<class_vector2>` pos **)**
  70. Set the position of the 2d node.
  71. .. _class_Node2D_set_rot:
  72. - void **set_rot** **(** :ref:`float<class_float>` rot **)**
  73. Set the rotation of the 2d node.
  74. .. _class_Node2D_set_scale:
  75. - void **set_scale** **(** :ref:`Vector2<class_vector2>` scale **)**
  76. Set the scale of the 2d node.
  77. .. _class_Node2D_get_pos:
  78. - :ref:`Vector2<class_vector2>` **get_pos** **(** **)** const
  79. Return the position of the 2D node.
  80. .. _class_Node2D_get_rot:
  81. - :ref:`float<class_float>` **get_rot** **(** **)** const
  82. Return the rotation of the 2D node.
  83. .. _class_Node2D_get_scale:
  84. - :ref:`Vector2<class_vector2>` **get_scale** **(** **)** const
  85. Return the scale of the 2D node.
  86. .. _class_Node2D_rotate:
  87. - void **rotate** **(** :ref:`float<class_float>` radians **)**
  88. .. _class_Node2D_move_local_x:
  89. - void **move_local_x** **(** :ref:`float<class_float>` delta, :ref:`bool<class_bool>` scaled=false **)**
  90. .. _class_Node2D_move_local_y:
  91. - void **move_local_y** **(** :ref:`float<class_float>` delta, :ref:`bool<class_bool>` scaled=false **)**
  92. .. _class_Node2D_translate:
  93. - void **translate** **(** :ref:`Vector2<class_vector2>` offset **)**
  94. .. _class_Node2D_global_translate:
  95. - void **global_translate** **(** :ref:`Vector2<class_vector2>` offset **)**
  96. .. _class_Node2D_scale:
  97. - void **scale** **(** :ref:`Vector2<class_vector2>` ratio **)**
  98. .. _class_Node2D_set_global_pos:
  99. - void **set_global_pos** **(** :ref:`Vector2<class_vector2>` pos **)**
  100. .. _class_Node2D_get_global_pos:
  101. - :ref:`Vector2<class_vector2>` **get_global_pos** **(** **)** const
  102. Return the global position of the 2D node.
  103. .. _class_Node2D_set_transform:
  104. - void **set_transform** **(** :ref:`Matrix32<class_matrix32>` xform **)**
  105. .. _class_Node2D_set_global_transform:
  106. - void **set_global_transform** **(** :ref:`Matrix32<class_matrix32>` xform **)**
  107. .. _class_Node2D_look_at:
  108. - void **look_at** **(** :ref:`Vector2<class_vector2>` point **)**
  109. .. _class_Node2D_get_angle_to:
  110. - :ref:`float<class_float>` **get_angle_to** **(** :ref:`Vector2<class_vector2>` point **)** const
  111. .. _class_Node2D_set_z:
  112. - void **set_z** **(** :ref:`int<class_int>` z **)**
  113. .. _class_Node2D_get_z:
  114. - :ref:`int<class_int>` **get_z** **(** **)** const
  115. .. _class_Node2D_set_z_as_relative:
  116. - void **set_z_as_relative** **(** :ref:`bool<class_bool>` enable **)**
  117. .. _class_Node2D_is_z_relative:
  118. - :ref:`bool<class_bool>` **is_z_relative** **(** **)** const
  119. .. _class_Node2D_edit_set_pivot:
  120. - void **edit_set_pivot** **(** :ref:`Vector2<class_vector2>` pivot **)**
  121. .. _class_Node2D_get_relative_transform_to_parent:
  122. - :ref:`Matrix32<class_matrix32>` **get_relative_transform_to_parent** **(** :ref:`Object<class_object>` parent **)** const