Introduction to GDScript & Godot
Godot is a free, open-source game engine, and GDScript is its built-in scripting language, designed specifically to feel natural for game development and to integrate tightly with the engine's editor.
Nodes and the scene tree
Everything in a Godot game is a node: a sprite, a button, a sound player, even an abstract logic container. Nodes are arranged into a tree, and a saved tree of nodes is called a scene:
Player (CharacterBody2D)
├── Sprite2D
├── CollisionShape2D
└── Camera2D
A scene can be instanced inside another scene, exactly like a reusable component, this is how a "Player" scene gets placed into a "Level" scene without duplicating its logic.
Your first script
extends Node2D
func _ready():
print("Hello, Kodstigen!")
func _process(delta):
# runs every single frame, delta is the time since the last frame in seconds
pass
extends Node2Dattaches this script's behavior to a node of typeNode2D(or anything that inherits from it), scripts in Godot are never standalone, they always extend some node type._ready()is a lifecycle method the engine calls automatically once, when the node first enters the running scene._process(delta)is called automatically every rendered frame,deltalets you write movement and animation that's consistent regardless of frame rate.
TIP
Function names starting with an underscore, like _ready and _process, are engine callbacks, Godot calls them for you at the right moment, you never call them yourself directly.