DEV Community

Cover image for Learn Godot in 15 Minutes — Make Your First Game!
Simon Norman
Simon Norman

Posted on

Learn Godot in 15 Minutes — Make Your First Game!

✅ What you’ll learn:

  • How to install and set up Godot 4
  • Understanding scenes, nodes, and the editor
  • Adding sprites and movement
  • Writing your first GDScript code
  • Running and testing your first game

💾 Download Godot: https://godotengine.org/download

Nodes

In Godot Engine, nodes are the fundamental building blocks of everything in your game. Understanding how nodes work is the key to mastering Godot.

Let’s break it down clearly

A node is a single unit of functionality in Godot’s scene system.
Each node has:

  • A name (used to identify it in the scene tree)

  • Properties (like position, rotation, visibility, etc.)

  • Signals (for event-based communication)

  • Methods (functions that define what it can do)

Think of a node as a component — it handles one specific role, such as displaying a sprite, playing a sound, or detecting collisions.

🌳 The Scene Tree

Nodes are organized in a tree structure (called the scene tree).
Each node can have child nodes. A node can only have one parent.
The root node of the tree is the top-most parent.
When you run the game, Godot creates a big scene tree that includes your main scene and all its sub-scenes.

Example:

Player (Node2D)
├── Sprite2D
├── CollisionShape2D
└── Camera2D

Here:

Player is the parent node.

Sprite2D, CollisionShape2D, and Camera2D are child nodes that handle visuals, collisions, and camera control respectively.

🧩 Node Types (Built-in)

Godot comes with hundreds of node types, each designed for specific tasks.
Some of the most common ones:

Category Node Type Description
2D Node2D, Sprite2D, AnimatedSprite2D, CollisionShape2D Used for 2D games
3D Node3D, MeshInstance3D, Camera3D Used for 3D games
UI Control, Button, Label, Panel Used for user interfaces
Logic / Other Timer, AudioStreamPlayer, AnimationPlayer Logic and effects
Physics Area2D, RigidBody2D, StaticBody2D Physics and collisions

🧠 Scenes = Groups of Nodes

A scene in Godot is a collection of nodes saved as a reusable unit.
Each scene has a root node and can be instanced (reused) inside other scenes.

Example:

You could make a Player.tscn scene with movement code.
Then instance that player scene in Level1.tscn, Level2.tscn, etc.
This is what makes Godot’s node system modular and scalable.

Make a Simple 2D Game

Let’s make a player that moves:

  1. Open Godot → “New Project”.
  2. Create a 2D Scene (root node = Node2D).
  3. Add a Sprite2D node → drag an image into Texture.
  4. Add a CollisionShape2D → choose a RectangleShape2D.
  5. Add a Script to the Sprite node and paste this:
extends Sprite2D

@export var speed = 200

func _process(delta):
    var input = Vector2.ZERO
    if Input.is_action_pressed("ui_right"):
        input.x += 1
    if Input.is_action_pressed("ui_left"):
        input.x -= 1
    if Input.is_action_pressed("ui_down"):
        input.y += 1
    if Input.is_action_pressed("ui_up"):
        input.y -= 1

    position += input.normalized() * speed * delta

Enter fullscreen mode Exit fullscreen mode

Click ▶️ Run → pick current scene → move with arrow keys!

Scenes

We’ve got a simple top-down movement script for our player (using a Sprite2D base). Let’s integrate an enemy into this setup.

🧩 Step 1: Make the Enemy Scene

  1. New Scene → Node2D → rename to Enemy

  2. Add:

Enemy (Node2D)
├── Sprite2D
└── Area2D
└── CollisionShape2D

The Area2D will let you later detect the player if you want.

  1. Assign a texture to the Sprite2D.

💡 Step 2: Add the Enemy Script

Attach a new script, Enemy.gd, to the Enemy node:

extends Node2D

@export var speed: float = 100.0
@export var move_distance: float = 200.0

var start_position: Vector2
var direction := 1

func _ready():
    start_position = global_position

func _process(delta):
    # Move left and right
    position.x += direction * speed * delta

    # Flip when reaching distance limit
    if abs(position.x - start_position.x) > move_distance:
        direction *= -1
        $Sprite2D.flip_h = direction < 0

Enter fullscreen mode Exit fullscreen mode

✅ This enemy will automatically move back and forth.

Save as:

res://Enemy.tscn

Enter fullscreen mode Exit fullscreen mode

🚀 Step 4: Instantiate Enemy in Your Player Scene

Drag and drop the res://Enemy.tscn in to the Node2D.tscn scene (which I should have named Player:)

https://youtu.be/ZHQHaQD0D8g?si=npQM6qw-5PlPe-Of

📢 Don’t forget to LIKE 👍, SUBSCRIBE 🔔, and COMMENT below what kind of game you’d like to make

🗣️ “If this helped you get started with Godot, hit the like button, subscribe for more beginner-friendly game dev tutorials, and comment what kind of game you want to build next!”

Top comments (0)