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