Lesson 02
We'll make a node print to the screen, react to time, and respond to a key. These three things — ready, process, and input — are the heartbeat of every Godot game.
Node, pick plain Node, and click Create. It appears as the root.Playground.playground.tscn.Playground → Attach Script.playground.gd. Click Create.Replace everything in it with this:
extends Node
# _ready() runs once, the moment this node enters the scene tree.
func _ready() -> void:
print("GridFall playground is alive.")
# _process(delta) runs every rendered frame.
# delta = seconds since the last frame (a small float like 0.016).
func _process(delta: float) -> void:
# Uncomment to see it fire constantly:
# print(delta)
pass
# _input(event) runs whenever an input event happens.
func _input(event: InputEvent) -> void:
if event is InputEventKey and event.pressed:
print("You pressed a key: ", event.as_text())Indentation is tabs
GDScript uses indentation for blocks like Python. Godot's editor inserts a real Tab by default — don't mix tabs and spaces or you'll get a parse error. If you paste code, the editor usually fixes it; if not, select all and press the auto-indent shortcut.
GridFall playground is alive.The three lifecycle methods
_ready() = setup, once. _process(delta) = per-frame logic, uses delta so movement is framerate-independent. _input(event) = respond to raw input. You will use all three constantly.
Notice -> void and delta: float. Those are optional type hints. GridFall uses them everywhere because they let Godot catch mistakes before you run, and they make autocomplete far better. Untyped GDScript works too, but typed code is how you avoid the silent bugs that plague bigger projects.
Checkpoint — expected state
playground.tscn scene with a scripted root Node._ready, _process, and _input each do.