Welcome to Godot
Godot is a free, open-source game engine. Games and tools are written in GDScript β a Python-like language built for Godot.
These lessons teach GDScript basics for programmers. You run scripts in the browser sandbox (Piston), not the full Godot editor.
What You'll Learnβ
| Lesson | Topics | End-of-chapter exercises |
|---|---|---|
| Lesson 1a | First script, print, strings | 3 β two lines β score label β battle cry |
| Lesson 2a | Variables, types, formatting | 3 β HP line β after hit β status board |
| Lesson 3a | if / elif / else | 3 β parity β HP band β can attack |
| Lesson 4a | Loops and arrays | 3 β countdown β names β highest score |
| Lesson 4b | Functions, params, returns | 3 β triple β status line β clamp |
| Lesson 4c | Dicts, classes, iterating objects | 3 β loot bag β coin purse β alive names |
| Lesson 5a | Vector2 + game_kit actors | 3 β length β walk β in range |
| Lesson 6a | Character / Static / Rigid bodies (mocked) | 3 β floor β static β impulse |
| Lesson 7a | Areas, overlap, collision layers | 3 β far β mask β fix mask |
| Lesson 8a | Mini arena (chase, score, goals) | 3 β score β goal β kite |
Each chapter teaches a couple of ideas, then a mini quiz and a graded challenge. The Exercises block at the end is ordered easy β harder β finish them in order.
Real engine vs mocksβ
| Available here | Needs the Godot editor |
|---|---|
Vector2, Color, Time, arrays, classes | Scene tree editing, InputMap, AnimationPlayer |
game_kit.gd actors & body/area mocks | Real CharacterBody2D physics frames |
Piston copies game_kit.gd into every run as res://game_kit.gd:
var Kit = preload("res://game_kit.gd")
How scripts run hereβ
GDScript uses 4 spaces for indentation in these lessons (the editor Tab key inserts spaces). Mixing tabs and spaces causes a parse error. If a starter looks flat, click Reset.
extends SceneTree- Start work in
_init() - Call
quit()when finished (or the sandbox will hang until timeout)
extends SceneTree
func _init():
print("Hello Godot")
quit()
Class rhythmβ
Same pattern as Python / C++:
- Teach 1β2 ideas, then a mini quiz or graded challenge
- End the chapter with Exercises (at least three, getting harder)
- Run code with Piston (
lang="godot")