Skip to content

Node 2D actions

22 actions in the Node 2D category. Each block mirrors how the action appears in the editor's sidebar.

Flip Sprite

Every Frame
Flip Sprite Node 2D
Target not set | Flipped false

Flips a Sprite2D or AnimatedSprite2D left to right, the usual way to face a character the way it moves.

Input Type Default Description
Target Node2D - The node to flip. Leave it empty to flip this node.
Flipped bool false True to face left, false to face right.

Phases StartEvery FramePhysicsEnd

Follow Mouse

Every Frame
Follow Mouse Node 2D
Node not set | Speed 200.0 | Rotate To Face true

Continuously moves the node toward the mouse, optionally turning to face it.

Input Type Default Description
Node Node - The node to move. Leave it empty to move this node.
Speed float 200.0 How fast to move toward the mouse, in pixels per second.
Rotate To Face bool true When true, the node turns to face the mouse.

Phases Every FramePhysics Works on Node2D

Follow Node

Every Frame
Follow Node Node 2D
Node not set | Target not set | Offset (0.0, 0.0) | Speed 8.0

Glides the node toward another node every frame, so it trails the target instead of snapping onto it. With Speed = 8 it keeps a health bar over an enemy head, a pet behind the player or a marker on a minimap, and Follow With Camera does the same for a camera.

Input Type Default Description
Node Node - The node that follows. Leave it empty to move this node.
Target Node - The node to follow.
Offset Vector2 (0.0, 0.0) How far from the target to sit, such as above its head.
Speed float 8.0 How fast the node catches up. A bigger value follows tighter.

Phases Every FramePhysics Works on Node2D

Get Angle To

Every Frame
Get Angle To Node 2D
Node not set | Target not set

Measures the angle from the node to a target and stores it, in degrees.

Input Type Default Description
Node Node - The node the angle is measured from. Leave it empty to measure from this node.
Target Node2D - The node to measure the angle to, such as another Node2D.
Output Type Description
Angle float Where to store the resulting angle, in degrees.

Phases StartEvery FramePhysicsEnd Works on Node2D

Get Distance

Every Frame
Get Distance Node 2D
Node not set | Target not set

Measures the distance from the node to a target and stores it, in pixels.

Input Type Default Description
Node Node - The node the distance is measured from. Leave it empty to measure from this node.
Target Node2D - The node to measure the distance to, such as another Node2D.
Output Type Description
Distance float Where to store the resulting distance, in pixels.

Phases StartEvery FramePhysicsEnd Works on Node2D

Get Facing Direction

Every Frame
Get Facing Direction Node 2D
not set

Reads the direction the node is facing and stores it, as a unit vector in global space. Useful to move or shoot straight ahead.

Input Type Default Description
Node Node - The node to read the facing of. Leave it empty to read this node.
Output Type Description
Forward Vector2 Where to store the facing direction, as a unit vector.

Phases StartEvery FramePhysicsEnd Works on Node2D

Is Facing

Every Frame
Is Facing Node 2D
Node not set | Target not set | Angle 45.0 | → Facing | → Away

Checks whether the node is turned toward a point, inside a cone of the given width, and branches on the answer. It fits an enemy that only notices what is in front of it, or a turret that only shoots forward.

Input Type Default Description
Node Node - The node that does the facing. Leave it empty to check this node.
Target Variant - The point to face. A node works too, its global position is read.
Angle float 45.0 Half the width of the cone in degrees, so 45 accepts a target up to 45 degrees off to either side.
Branch Goes to
Facing Where to go while the target is inside the cone.
Away Where to go while the target is outside it.

Phases StartEvery FramePhysics Works on Node2D

Is On Screen

Every Frame
Is On Screen Node 2D
not set | → True | → False

Answers whether the node is inside the visible screen, so a bullet or an enemy that left the view can be cleared. It can branch on the answer or hand it to a field that takes a yes or no.

Input Type Default Description
Node Node - The node to check. Leave it empty to check this node.
Output Type Description
Yes bool Where to store whether the node is inside the view.
Branch Goes to
True Where to go while the node is on screen.
False Where to go once the node is off screen.

Phases StartEvery FramePhysics Works on Node2D

Keep On Screen

Physics
Keep On Screen Node 2D
Node not set | Margin 0.0

Holds the node inside the screen, stopping it at the edge instead of letting it leave. Assumes a fixed screen with no scrolling camera.

Input Type Default Description
Node Node - The node to keep on screen. Leave it empty to keep this node.
Margin float 0.0 How far inside each edge the node stops, in pixels.

Phases Every FramePhysics Works on Node2D

Look At

Every Frame
Look At Node 2D
Node not set | Target (0.0, 0.0)

Rotates the node so its right side faces a point in global space.

Input Type Default Description
Node Node - The node to turn. Leave it empty to turn this node.
Target Vector2 (0.0, 0.0) The point in global space to face.

Phases StartEvery FramePhysicsEnd Works on Node2D

Move

Every Frame
Move Node 2D
Node not set | Velocity (120.0, 0.0) | Speed 1.0

Moves the node by a velocity. During update it is applied per second; on enter or exit it is applied once.

Input Type Default Description
Node Node - The node to move. Leave it empty to move this node.
Velocity Vector2 (120.0, 0.0) The direction and speed to move, in pixels.
Speed float 1.0 Multiplier applied to the velocity.

Phases StartEvery FramePhysicsEnd Works on Node2D

Move Towards

Every Frame
Move Towards Node 2D
Node not set | Target (0.0, 0.0) | Speed 200.0 | → Arrived | → Moving

Moves the node a step toward a target each frame, stopping once it arrives.

Input Type Default Description
Node Node - The node to move. Leave it empty to move this node.
Target Vector2 (0.0, 0.0) The point in global space to move toward.
Speed float 200.0 How fast to move, in pixels per second.
Branch Goes to
Arrived Where to go on the frame the node lands on the target.
Moving Where to go while the target is still ahead.

Phases Every FramePhysics Works on Node2D

Rotate

Every Frame
Rotate Node 2D
Node not set | Speed 90.0

Rotates the node. During update the speed is degrees per second; on enter or exit it turns once by that amount.

Input Type Default Description
Node Node - The node to spin. Leave it empty to spin this node.
Speed float 90.0 How fast to rotate, in degrees per second.

Phases StartEvery FramePhysicsEnd Works on Node2D

Rotate Toward

Every Frame
Rotate Toward Node 2D
Node not set | Target (0.0, 0.0) | Speed 360.0 | → Aimed | → Turning

Turns the node smoothly each frame until it faces a point, instead of snapping like Look At. Higher speed turns faster.

Input Type Default Description
Node Node - The node to turn. Leave it empty to turn this node.
Target Vector2 (0.0, 0.0) The point in global space to face.
Speed float 360.0 How fast to turn, in degrees per second.
Branch Goes to
Aimed Where to go once the node points at the target, give or take a degree.
Turning Where to go while the node is still off the target.

Phases Every FramePhysics Works on Node2D

Set Draw Order

Start
Set Draw Order Node 2D
Node not set | Order 0

Sets the draw order of the node. A higher value draws in front of nodes with a lower one.

Input Type Default Description
Node Node - The node to reorder. Leave it empty to reorder this node.
Order int 0 The draw order. Higher draws in front.

Phases StartEvery FramePhysicsEnd Works on CanvasItem

Set Position

Every Frame
Set Position Node 2D
Node not set | Position (0.0, 0.0)

Places the node at a position, measured in its parent space.

Input Type Default Description
Node Node - The node to place. Leave it empty to place this node.
Position Vector2 (0.0, 0.0) The new position, in parent space.

Phases StartEvery FramePhysicsEnd Works on Node2D

Set Rotation

Every Frame
Set Rotation Node 2D
Node not set | Angle 0.0

Points the node at an angle, in degrees, replacing whatever rotation it had. Zero puts it back upright. Rotate adds to the current angle instead.

Input Type Default Description
Node Node - The node to turn. Leave it empty to turn this node.
Angle float 0.0 The angle to point at, in degrees. Zero is upright.

Phases StartEvery FramePhysicsEnd Works on Node2D

Set Scale

Every Frame
Set Scale Node 2D
Node not set | Scale (1.0, 1.0)

Sets the scale of the node.

Input Type Default Description
Node Node - The node to resize. Leave it empty to resize this node.
Scale Vector2 (1.0, 1.0) The new scale, where 1 by 1 is the normal size.

Phases StartEvery FramePhysicsEnd Works on Node2D

Set World Position

Start
Set World Position Node 2D
Node not set | Position (0.0, 0.0)

Places the node at a point in global space, ignoring the parent. Set Position uses the parent space instead.

Input Type Default Description
Node Node - The node to place. Leave it empty to place this node.
Position Vector2 (0.0, 0.0) The new position, in global space.

Phases StartEvery FramePhysicsEnd Works on Node2D

Steer

Physics
Steer Node 2D
Node not set | Amount 0.0 | Degrees 180.0

Turns the node left or right from a steering input, useful for car-like or top-down movement.

Input Type Default Description
Node Node - The node to steer. Leave it empty to steer this node.
Amount float 0.0 Steering input from -1 to 1, where negative turns one way and positive the other.
Degrees float 180.0 Maximum turn rate, in degrees per second.

Phases Every FramePhysics Works on Node2D

Translate

Every Frame
Translate Node 2D
Node not set | Offset (100.0, 0.0)

Moves the node by an offset. During update it is applied per second; on enter or exit it is applied once.

Input Type Default Description
Node Node - The node to move. Leave it empty to move this node.
Offset Vector2 (100.0, 0.0) The amount to move, in pixels.

Phases StartEvery FramePhysicsEnd Works on Node2D

Wrap Around Screen

Physics
Wrap Around Screen Node 2D
not set

Sends the node to the opposite edge when it leaves the screen, the way an asteroid reappears on the far side. Assumes a fixed screen with no scrolling camera.

Input Type Default Description
Node Node - The node to wrap around the screen. Leave it empty to wrap this node.

Phases Every FramePhysics Works on Node2D