A step-by-step beginner guide to building a complete 2D platformer using Godot 4 and GDScript. No game dev experience needed just follow along module by module.
By the end you'll have a fully playable 2D platformer and the skills to keep building from there.
Follow along from zero to a finished, exportable game. Every module builds on the last.
Install Godot 4, understand the editor interface, configure project settings, and organise your asset folders.
res://scenes/, res://scripts/, res://assets/Create the player scene, set up CollisionShape2D, and write your first GDScript basic structure and properties.
res://scenes/player.tscn# player.gd starter script extends CharacterBody2D const SPEED = 200.0 const JUMP_VELOCITY = -450.0 var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
Implement responsive left/right movement, jump velocity, gravity, and the move_and_slide() loop.
func _physics_process(delta): # Apply gravity when airborne if not is_on_floor(): velocity.y += gravity * delta # Jump if Input.is_action_just_pressed("ui_accept"): if is_on_floor(): velocity.y = JUMP_VELOCITY # Horizontal movement var direction = Input.get_axis("ui_left", "ui_right") velocity.x = direction * SPEED move_and_slide()
Build your levels using TileSets and TileMaps, add collision layers, and design your first playable stage.
Simple patrolling enemy AI using RayCast2D, player death via Area2D overlap, and respawn checkpoints.
# enemy.gd simple patrol AI func _physics_process(delta): if direction == 1 and $RightWall.is_colliding(): direction = -1 elif direction == -1 and $LeftWall.is_colliding(): direction = 1 velocity.x = direction * SPEED move_and_slide()
Coin collectibles with Area2D, a score counter HUD using Labels, and managing game state with Autoloads.
# coin.gd collected by player func _on_body_entered(body): if body.is_in_group("player"): GameState.score += 1 emit_signal("coin_collected") queue_free()
Add sound effects with AudioStreamPlayer, background music, and build a simple main menu scene with buttons.
get_tree().change_scene_to_file("res://scenes/level_1.tscn")Configure export templates, build for PC and HTML5 web, and prepare for itch.io upload.
Create beautiful dust trails for landing jumps and sparkling effects for coin pickups using GPUParticles2D.
$DustParticles.restart() on landing detection# Detect landing to trigger dust burst var was_on_floor = false func _physics_process(delta): var just_landed = is_on_floor() and not was_on_floor if just_landed: $DustParticles.restart() was_on_floor = is_on_floor()
GDScript is Godot's beginner-friendly Python-like language. Here's a taste of what you'll write across the modules.
if Input.is_action_just_pressed("ui_accept"): if is_on_floor(): velocity.y = JUMP_VELOCITY # Apply gravity when airborne if not is_on_floor(): velocity.y += gravity * delta
func _on_body_entered(body): if body.is_in_group("player"): GameState.score += 1 emit_signal("coin_collected") queue_free()
func _physics_process(delta): if direction == 1 and $RightWall.is_colliding(): direction = -1 elif direction == -1 and $LeftWall.is_colliding(): direction = 1 move_and_slide()
func _on_goal_reached(): # Save score, load next level GameState.save_score() get_tree().change_scene_to_file( "res://scenes/level_2.tscn" )
All 8 modules plus the bonus chapter step by step, with code examples throughout. Download free and go at your own pace.
The tutorial is kept up to date with the latest Godot releases and community feedback.