Node2D.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Node2D" inherits="CanvasItem" category="Core" version="3.0.alpha.custom_build">
  3. <brief_description>
  4. A 2D game object, parent of all 2D related nodes. Has a position, rotation, scale and Z-index.
  5. </brief_description>
  6. <description>
  7. 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.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <demos>
  12. </demos>
  13. <methods>
  14. <method name="apply_scale">
  15. <return type="void">
  16. </return>
  17. <argument index="0" name="ratio" type="Vector2">
  18. </argument>
  19. <description>
  20. Multiplies the current scale by the 'ratio' vector.
  21. </description>
  22. </method>
  23. <method name="edit_set_pivot">
  24. <return type="void">
  25. </return>
  26. <argument index="0" name="pivot" type="Vector2">
  27. </argument>
  28. <description>
  29. Sets the node's pivot position.
  30. </description>
  31. </method>
  32. <method name="get_angle_to" qualifiers="const">
  33. <return type="float">
  34. </return>
  35. <argument index="0" name="point" type="Vector2">
  36. </argument>
  37. <description>
  38. Returns the angle between the node and the 'point' in radians.
  39. </description>
  40. </method>
  41. <method name="get_global_position" qualifiers="const">
  42. <return type="Vector2">
  43. </return>
  44. <description>
  45. Returns the node's global position.
  46. </description>
  47. </method>
  48. <method name="get_global_rotation" qualifiers="const">
  49. <return type="float">
  50. </return>
  51. <description>
  52. Returns the node's global rotation in radians.
  53. </description>
  54. </method>
  55. <method name="get_global_rotation_in_degrees" qualifiers="const">
  56. <return type="float">
  57. </return>
  58. <description>
  59. Return the node's global rotation in degrees.
  60. </description>
  61. </method>
  62. <method name="get_global_scale" qualifiers="const">
  63. <return type="Vector2">
  64. </return>
  65. <description>
  66. Returns the node's global scale.
  67. </description>
  68. </method>
  69. <method name="get_position" qualifiers="const">
  70. <return type="Vector2">
  71. </return>
  72. <description>
  73. Returns the node's position.
  74. </description>
  75. </method>
  76. <method name="get_relative_transform_to_parent" qualifiers="const">
  77. <return type="Transform2D">
  78. </return>
  79. <argument index="0" name="parent" type="Node">
  80. </argument>
  81. <description>
  82. Returns the [Transform2D] relative to this node's parent.
  83. </description>
  84. </method>
  85. <method name="get_rotation" qualifiers="const">
  86. <return type="float">
  87. </return>
  88. <description>
  89. Returns the node's rotation in radians.
  90. </description>
  91. </method>
  92. <method name="get_rotation_in_degrees" qualifiers="const">
  93. <return type="float">
  94. </return>
  95. <description>
  96. Returns the node's rotation in degrees.
  97. </description>
  98. </method>
  99. <method name="get_scale" qualifiers="const">
  100. <return type="Vector2">
  101. </return>
  102. <description>
  103. Returns the node's scale.
  104. </description>
  105. </method>
  106. <method name="get_z" qualifiers="const">
  107. <return type="int">
  108. </return>
  109. <description>
  110. Returns the node's Z-index.
  111. </description>
  112. </method>
  113. <method name="global_translate">
  114. <return type="void">
  115. </return>
  116. <argument index="0" name="offset" type="Vector2">
  117. </argument>
  118. <description>
  119. Adds the 'offset' vector to the node's global position.
  120. </description>
  121. </method>
  122. <method name="is_z_relative" qualifiers="const">
  123. <return type="bool">
  124. </return>
  125. <description>
  126. Returns true if this node's Z-index is relative to its parent's. Else, returns false.
  127. </description>
  128. </method>
  129. <method name="look_at">
  130. <return type="void">
  131. </return>
  132. <argument index="0" name="point" type="Vector2">
  133. </argument>
  134. <description>
  135. Rotates the node so it points towards the 'point'.
  136. </description>
  137. </method>
  138. <method name="move_local_x">
  139. <return type="void">
  140. </return>
  141. <argument index="0" name="delta" type="float">
  142. </argument>
  143. <argument index="1" name="scaled" type="bool" default="false">
  144. </argument>
  145. <description>
  146. 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 false, normalizes the movement.
  147. </description>
  148. </method>
  149. <method name="move_local_y">
  150. <return type="void">
  151. </return>
  152. <argument index="0" name="delta" type="float">
  153. </argument>
  154. <argument index="1" name="scaled" type="bool" default="false">
  155. </argument>
  156. <description>
  157. 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 false, normalizes the movement.
  158. </description>
  159. </method>
  160. <method name="rotate">
  161. <return type="void">
  162. </return>
  163. <argument index="0" name="radians" type="float">
  164. </argument>
  165. <description>
  166. Applies a rotation to the node, in radians, starting from its current rotation.
  167. </description>
  168. </method>
  169. <method name="set_global_position">
  170. <return type="void">
  171. </return>
  172. <argument index="0" name="position" type="Vector2">
  173. </argument>
  174. <description>
  175. Sets the node's global position.
  176. </description>
  177. </method>
  178. <method name="set_global_rotation">
  179. <return type="void">
  180. </return>
  181. <argument index="0" name="radians" type="float">
  182. </argument>
  183. <description>
  184. Sets the node's global rotation in radians.
  185. </description>
  186. </method>
  187. <method name="set_global_rotation_in_degrees">
  188. <return type="void">
  189. </return>
  190. <argument index="0" name="degrees" type="float">
  191. </argument>
  192. <description>
  193. Sets the node's global rotation in degrees.
  194. </description>
  195. </method>
  196. <method name="set_global_scale">
  197. <return type="void">
  198. </return>
  199. <argument index="0" name="scale" type="Vector2">
  200. </argument>
  201. <description>
  202. Sets the node's global scale.
  203. </description>
  204. </method>
  205. <method name="set_global_transform">
  206. <return type="void">
  207. </return>
  208. <argument index="0" name="xform" type="Transform2D">
  209. </argument>
  210. <description>
  211. Sets the node's global [Transform2D].
  212. </description>
  213. </method>
  214. <method name="set_position">
  215. <return type="void">
  216. </return>
  217. <argument index="0" name="position" type="Vector2">
  218. </argument>
  219. <description>
  220. Sets the node's position.
  221. </description>
  222. </method>
  223. <method name="set_rotation">
  224. <return type="void">
  225. </return>
  226. <argument index="0" name="radians" type="float">
  227. </argument>
  228. <description>
  229. Sets the node's rotation in radians.
  230. </description>
  231. </method>
  232. <method name="set_rotation_in_degrees">
  233. <return type="void">
  234. </return>
  235. <argument index="0" name="degrees" type="float">
  236. </argument>
  237. <description>
  238. Sets the node's rotation in degrees.
  239. </description>
  240. </method>
  241. <method name="set_scale">
  242. <return type="void">
  243. </return>
  244. <argument index="0" name="scale" type="Vector2">
  245. </argument>
  246. <description>
  247. Sets the node's scale.
  248. </description>
  249. </method>
  250. <method name="set_transform">
  251. <return type="void">
  252. </return>
  253. <argument index="0" name="xform" type="Transform2D">
  254. </argument>
  255. <description>
  256. Sets the node's local [Transform2D].
  257. </description>
  258. </method>
  259. <method name="set_z">
  260. <return type="void">
  261. </return>
  262. <argument index="0" name="z" type="int">
  263. </argument>
  264. <description>
  265. Sets the node's Z-index.
  266. </description>
  267. </method>
  268. <method name="set_z_as_relative">
  269. <return type="void">
  270. </return>
  271. <argument index="0" name="enable" type="bool">
  272. </argument>
  273. <description>
  274. Makes the node's Z-index 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.
  275. </description>
  276. </method>
  277. <method name="to_global" qualifiers="const">
  278. <return type="Vector2">
  279. </return>
  280. <argument index="0" name="local_point" type="Vector2">
  281. </argument>
  282. <description>
  283. Converts a local point's coordinates to global coordinates.
  284. </description>
  285. </method>
  286. <method name="to_local" qualifiers="const">
  287. <return type="Vector2">
  288. </return>
  289. <argument index="0" name="global_point" type="Vector2">
  290. </argument>
  291. <description>
  292. Converts a global point's coordinates to local coordinates.
  293. </description>
  294. </method>
  295. <method name="translate">
  296. <return type="void">
  297. </return>
  298. <argument index="0" name="offset" type="Vector2">
  299. </argument>
  300. <description>
  301. Translates the node by the given [code]offset[/code] in local coordinates.
  302. </description>
  303. </method>
  304. </methods>
  305. <members>
  306. <member name="global_position" type="Vector2" setter="set_global_position" getter="get_global_position">
  307. Global position.
  308. </member>
  309. <member name="global_rotation" type="float" setter="set_global_rotation" getter="get_global_rotation">
  310. Global rotation in radians.
  311. </member>
  312. <member name="global_rotation_deg" type="float" setter="set_global_rotation_in_degrees" getter="get_global_rotation_in_degrees">
  313. Global rotation in degrees.
  314. </member>
  315. <member name="global_scale" type="Vector2" setter="set_global_scale" getter="get_global_scale">
  316. Global scale.
  317. </member>
  318. <member name="global_transform" type="Transform2D" setter="set_global_transform" getter="get_global_transform">
  319. Global [Transform2D].
  320. </member>
  321. <member name="position" type="Vector2" setter="set_position" getter="get_position">
  322. Position, relative to the node's parent.
  323. </member>
  324. <member name="rotation" type="float" setter="set_rotation" getter="get_rotation">
  325. Rotation in radians, relative to the node's parent.
  326. </member>
  327. <member name="rotation_deg" type="float" setter="set_rotation_in_degrees" getter="get_rotation_in_degrees">
  328. Rotation in degrees, relative to the node's parent.
  329. </member>
  330. <member name="scale" type="Vector2" setter="set_scale" getter="get_scale">
  331. The node's scale. Unscaled value: [code](1, 1)[/code]
  332. </member>
  333. <member name="transform" type="Transform2D" setter="set_transform" getter="get_transform">
  334. Local [Transform2D].
  335. </member>
  336. <member name="z" type="int" setter="set_z" getter="get_z">
  337. Z-index. Controls the order in which the nodes render. A node with a higher Z-index will display in front of others.
  338. </member>
  339. <member name="z_as_relative" type="bool" setter="set_z_as_relative" getter="is_z_relative">
  340. 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.
  341. </member>
  342. </members>
  343. <constants>
  344. </constants>
  345. </class>