How To
Godot 4
Build Your First Platformer
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.
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.
Get Godot 4 installed, create a new project, and understand the editor layout.
res://scenes/, res://scripts/, res://assets/.Build a Player scene with CharacterBody2D, Sprite2D, CollisionShape2D and attach your first GDScript.
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")
Write the _physics_process function so the player can run left/right and jump.
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()
Create a playable level using TileMap and TileSet with proper collision, plus a smooth camera.
Add a patrolling enemy that kills the player on contact, plus respawn logic.
# 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()
Create coin collectibles, a HUD showing score and lives, and a global GameState Autoload.
# 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 audio, build a main menu scene, and wire up scene transitions.
get_tree().change_scene_to_file("res://scenes/level_1.tscn").Export your finished game for PC and web, and prepare it for itch.io.
Add beautiful particle effects for landing dust and coin pickup sparkles.
$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.
🛠️ Free In-House Dev Tools
Use these free browser tools alongside this workshop to create custom sprites, sounds, levels and colour schemes for your game. No installs. Free forever.