DEV Community

Cover image for Understanding Nodes in Godot (For Absolute Beginners)
Jimmy McBride
Jimmy McBride Subscriber

Posted on

Understanding Nodes in Godot (For Absolute Beginners)

If you’re new to Godot, you’ve probably seen the word Node thrown around everywhere.
And that’s because — in Godot — everything is a Node.

Scenes, characters, UI elements, even background music… all of it.

Think of Nodes like Lego bricks. Each one has a specific purpose, and when you start snapping them together, you can build literally anything — from a main menu to a full 3D world.


🧱 What Is a Node, Really?

A Node is the most basic building block in Godot.
It’s a single piece of functionality — like “draw a sprite,” “play a sound,” or “run this script.”

Every Node has:

  • A name — how you reference it in the tree.
  • A type — what kind of thing it is (like Sprite2D, Camera2D, Timer, etc.).
  • A parent and children — Nodes form hierarchies.
  • And optionally, a script attached for custom behavior.

You can think of it like this:

Player (Node2D)
├── Sprite2D
├── CollisionShape2D
└── Script (GDScript or C#)
Enter fullscreen mode Exit fullscreen mode

Each part of the player — the art, the physics, the logic — is just another Node.


🌲 The Scene Tree

When you look at your project in Godot, everything is organized in a scene tree.
Every scene (yes, every .tscn file) is actually just a saved tree of Nodes.

For example, your main scene might look like this:

MainScene
├── Player
│   ├── Sprite2D
│   └── Camera2D
└── EnemySpawner
    ├── Timer
    └── Marker2D
Enter fullscreen mode Exit fullscreen mode

Each node has a parent, and each parent can have children.
If you move or delete the parent, everything underneath it moves or deletes too — just like folders and files.

That’s why you’ll often hear people say:

“Once you understand the scene tree, you understand Godot.”


🧩 Different Types of Nodes

There are hundreds of node types in Godot, but here are a few of the main categories you’ll use constantly:

Node Type Purpose
Node2D / Node3D Anything that exists in 2D or 3D space (position, rotation, scale)
Control UI elements like buttons, labels, panels
AudioStreamPlayer Plays sounds or music
Area2D / CollisionShape2D Detects overlaps and collisions
Timer Runs code after a delay or on a loop
Node The most basic type, purely for logic or grouping

Each Node type comes with built-in properties and functions.
For example, Node2D has position, rotation, and scale.
You can move it with a single line:

GDScript

extends Node2D

func _process(delta):
    position.x += 1
Enter fullscreen mode Exit fullscreen mode

C#

public partial class Mover : Node2D
{
    public override void _Process(double delta)
    {
        Position = new Vector2(Position.X + 1, Position.Y);
    }
}
Enter fullscreen mode Exit fullscreen mode

🪜 Parents, Children, and Hierarchies

Nodes don’t live alone — they live in hierarchies.

If you move a parent node, all its children move with it.
If you delete a parent, its children go too.

That’s powerful because it lets you build self-contained systems.
Your Player node might have a Camera2D, Sprite2D, and CollisionShape2D as children — all following the player automatically.

You can also communicate easily:

GDScript

# From a parent to a child
$ChildNode.visible = false

# From a child to its parent
get_parent().do_something()
Enter fullscreen mode Exit fullscreen mode

C#

// From a parent to a child
GetNode<Node2D>("ChildNode").Visible = false;

// From a child to its parent
(GetParent() as ParentClass)?.DoSomething();
Enter fullscreen mode Exit fullscreen mode

It’s a simple but elegant system.
You don’t need a big “GameObject” class or complex component setup — Nodes are the components.


🧱 Scenes: Reusable Node Trees

Here’s the best part: a Scene in Godot is just a saved tree of nodes.

You can make a Player scene, save it, and then drag it into your Level scene — and it becomes a single node with all its children tucked neatly inside.

LevelScene
├── Player (instanced scene)
├── Enemy (instanced scene)
├── Background
└── UI
Enter fullscreen mode Exit fullscreen mode

That means you can design your Player once and reuse it in every level.
Godot’s scene system is modular by design — build small, combine big.


⚙️ Adding Behavior with Scripts

Nodes can do a lot on their own, but when you want custom logic, you attach a script.

GDScript

extends Node2D

@export var speed = 200

func _process(delta):
    position.x += speed * delta
Enter fullscreen mode Exit fullscreen mode

C#

using Godot;

public partial class Player : Node2D
{
    [Export] public float Speed { get; set; } = 200f;

    public override void _Process(double delta)
    {
        Position += new Vector2(Speed * (float)delta, 0);
    }
}
Enter fullscreen mode Exit fullscreen mode

That’s it — you’ve just given your node behavior.
Scripts turn nodes from static data into dynamic, interactive parts of your game.
Every script “extends” the node it’s attached to — meaning it is that node.
extends Node2D means your script is a Node2D with extra powers.


⚡ Signals: How Nodes Talk to Each Other

Signals are Godot’s event system.
They let nodes communicate without directly depending on each other — which keeps your code clean.

GDScript

# Player.gd
signal died

func die():
    emit_signal("died")

# MainScene.gd
func _ready():
    $Player.connect("died", self, "_on_player_died")

func _on_player_died():
    print("Player died!")
Enter fullscreen mode Exit fullscreen mode

C#

// Player.cs
[Signal]
public delegate void DiedEventHandler();

public void Die()
{
    EmitSignal(SignalName.Died);
}

// MainScene.cs
public override void _Ready()
{
    var player = GetNode<Player>("Player");
    player.Died += OnPlayerDied;
}

private void OnPlayerDied()
{
    GD.Print("Player died!");
}
Enter fullscreen mode Exit fullscreen mode

That’s it — your MainScene knows when the Player dies, but the Player doesn’t care who’s listening.
It just says “Hey, I died!” and anyone connected gets the message.


🕹️ Example: Building a Simple Player

Let’s put it all together.

Scene Tree

Player (CharacterBody2D)
├── Sprite2D
├── CollisionShape2D
└── Camera2D
Enter fullscreen mode Exit fullscreen mode

GDScript Version

extends CharacterBody2D

@export var speed = 200

func _physics_process(delta):
    var input = Vector2.ZERO
    input.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
    input.y = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")
    velocity = input.normalized() * speed
    move_and_slide()
Enter fullscreen mode Exit fullscreen mode

C# Version

using Godot;

public partial class Player : CharacterBody2D
{
    [Export] public float Speed { get; set; } = 200f;

    public override void _PhysicsProcess(double delta)
    {
        var input = Vector2.Zero;
        input.X = Input.GetActionStrength("ui_right") - Input.GetActionStrength("ui_left");
        input.Y = Input.GetActionStrength("ui_down") - Input.GetActionStrength("ui_up");

        Velocity = input.Normalized() * Speed;
        MoveAndSlide();
    }
}
Enter fullscreen mode Exit fullscreen mode

You’ve got:

  • A node for position and physics
  • Children for visuals and collision
  • A script to control movement

That’s a playable character — no boilerplate, no setup pain, just nodes working together.


🧠 Wrapping Up

Once you understand Nodes, everything in Godot makes sense.
You stop thinking in terms of “objects” or “entities” and start thinking in trees — small, simple parts that combine into something powerful.

Top comments (0)