How to Make a Game in Godot 4: Build Your First Platformer
Learn how to make a game in Godot 4: download the free engine, learn the editor, build a 2D platformer with coins, an enemy and a score, then export it.

To make a game in Godot 4, download the free editor from godotengine.org, create a 2D project and build the game from small pieces called scenes: a player, a level, coins and an enemy. This guide walks you through a tiny platformer step by step, and it explains every line of GDScript you type. At the end you export the game, so your friends can play it on their own computers.
Download Godot 4 and create a project
Godot is a free, open-source game engine. A game engine is a program that handles the hard parts of a game for you: graphics, physics, sound and input. You only build the parts that make your game special.
- Download Godot. On the official download page, choose Godot Engine, not the .NET version (that one is for C#). As of November 2026, the current stable version is Godot 4.7.2. Skip test versions such as 4.8 beta, which can still have bugs.
- Unzip it and start it. Godot needs no installer. On Windows, double-click the program. On a Mac, drag it into Applications first.
- Create a project. The Project Manager opens first. Click Create, name the project "Coin Jumper" and pick an empty folder, or tick Create Folder.
- Choose the Compatibility renderer. The renderer is the part of Godot that draws the screen. Compatibility runs on older computers and is the only renderer that works for web games. Click Create.
- Make pixel art sharp. Open Project > Project Settings, go to Rendering > Textures and set Default Texture Filter to Nearest. Without this, small pixel art looks blurry.
You also need art. Kenney's free Pixel Platformer pack has a hero, coins, enemies and tiles in one matching style. It uses the CC0 licence, so you may use it in any game, even one you sell. Unzip it and drag the folder into Godot's FileSystem dock.
Learn the Godot editor in ten minutes
Godot's window looks busy at first, but you only need five areas. Most of them are docks: panels you can drag to new places. If you ever lose one, choose Editor > Editor Layout > Default to reset the layout.
The Scene dock lists the nodes in the scene you have open. A node is one building block with one job, such as showing a picture or playing a sound. The Inspector shows the settings, or properties, of the node you selected. The 2D, Script and Game buttons at the top switch what the middle of the screen shows.
The run buttons sit in the top-right corner. F5 runs the whole game, F6 runs only the open scene and F8 stops it. On a Mac, use Cmd+B, Cmd+R and Cmd+. instead.
Plan your first game (keep it tiny)
Most first games fail because they are too big, not because they are too hard. So this game is small on purpose. In Coin Jumper you run and jump across platforms, collect five coins and avoid a walking slime. Touch the slime or fall off, and the level restarts. Grab every coin and you win.
In Godot you build a game from scenes. A scene is a group of nodes saved as a .tscn file. You can drop a scene into another scene as often as you like. This is called instancing, and each copy is an instance. Coin Jumper needs four scenes:
For the full picture, read Godot nodes and scenes explained after this game.
Make the player: movement and jumping
- Create the scene. Choose Scene > New Scene. In the Scene dock, click Other Node, search for CharacterBody2D and click Create. Double-click the new node and rename it Player. A CharacterBody2D is a body you move with code. It stops at walls and floors instead of passing through them.
- Add a picture. With Player selected, click the + button (Add Child Node) and add a Sprite2D. Drag a character image from the FileSystem dock onto its Texture property in the Inspector. Is the image a grid of characters? Set Hframes and Vframes (under Animation) to its columns and rows, then pick a Frame.
- Add a collision shape. Add a CollisionShape2D to Player. In the Inspector, click Shape and choose New RectangleShape2D. Drag the small handles until the box covers the character. Physics uses this invisible shape, not the picture.
- Add a camera. Add a Camera2D to Player, so the view follows it. Set its Zoom to 3 and 3 to make small pixel art bigger. In Godot 4, a bigger zoom number means closer.
- Save. Press Ctrl+S (Cmd+S on a Mac) and save the scene as
player.tscn.
Next, tell Godot which keys do what. Open Project > Project Settings and click the Input Map tab. Type move_left in the box at the top and click Add. Click the + next to the new action, press the A key and click OK. Repeat this for move_right (D), jump (Space) and restart (R). These named input actions let you change keys later without touching your code.
Now select Player and click the Attach Script button, the scroll icon at the top of the Scene dock. Keep the default settings, click Create, then replace all the code with this:
extends CharacterBody2D
const SPEED = 130.0 # pixels per second
const JUMP_VELOCITY = -300.0 # negative means up in 2D
# Runs 60 times a second, in step with the physics engine.
func _physics_process(delta: float) -> void:
# Fall when you are not standing on something.
if not is_on_floor():
velocity += get_gravity() * delta
# Jump, but only from the floor.
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = JUMP_VELOCITY
# -1 = left key, 1 = right key, 0 = neither.
var direction := Input.get_axis("move_left", "move_right")
velocity.x = direction * SPEED
if direction != 0:
$Sprite2D.flip_h = direction < 0 # face the way you run
move_and_slide() # move, sliding along floors and walls
if position.y > 1000: # fell below the level?
die()
func die() -> void:
# Reload the level once the physics step has finished.
get_tree().reload_current_scene.call_deferred()
Three ideas make this script work. velocity is a built-in property of CharacterBody2D: its speed and direction in pixels per second. In Godot's 2D world, y grows downwards, so a jump uses a negative number. And delta is the time since the last physics step, which keeps gravity the same on fast and slow computers.
$Sprite2D means "my child node called Sprite2D". If your hero faces the wrong way, change < to > in that line. The 1000 is a height below your lowest platform, so raise it if you build further down. Our GDScript for beginners guide explains every keyword.
Build a level with a TileMapLayer
A tile map builds a level from small square pictures called tiles, like digital Lego. In Godot 4.3 and newer, the node for this is TileMapLayer. The older TileMap node in many tutorials is outdated.
- Create the main scene. Make a new scene with a Node2D root, rename it Main and save it as
main.tscn. Right-clickmain.tscnin the FileSystem dock and choose Set as Main Scene, so F5 starts here. - Add the tile layer. Add a TileMapLayer child to Main. In the Inspector, click Tile Set and choose New TileSet. Click the new TileSet to open it and set Tile Size to 18 by 18, the size of Kenney's tiles, before you add any tiles.
- Load the tiles. Open the TileSet tab at the bottom of the editor. Drag the tile sheet, the image with all the tiles in a grid, into it. If one version has "packed" in its name, use that one: it has no gaps between tiles. When Godot asks whether to create tiles automatically, click Yes.
- Make the ground solid. In the Inspector, open Physics Layers and click Add Element. Back in the TileSet tab, switch to Paint mode and pick your physics layer under Paint Properties. With the mouse over the TileSet panel, press F to make a full square shape, then click every tile that should be solid.
- Paint the level. Open the TileMap tab at the bottom, pick a tile and paint in the viewport with the left mouse button. The right button erases. Build some ground, three or four platforms and one gap to jump over.
- Add the player. Drag
player.tscnfrom the FileSystem dock into the level, just above the ground. Press F5, and you can run and jump.
Player falling through the ground? The tiles have no collision yet. Tiles cut off or shifted? The Tile Size does not match your image.
Add coins and a score
- Make the coin scene. Create a new scene with an Area2D root named Coin. An Area2D blocks nothing. It only notices when something enters it, which is perfect for pickups. Give it a Sprite2D with a coin image and a CollisionShape2D with a New CircleShape2D. Save it as
coin.tscn. - Attach a script. Select Coin, click Attach Script and click Create.
- Connect a signal. A signal is a message a node sends when something happens. Open the Signals tab next to the Inspector, double-click body_entered and click Connect. Godot writes an empty function into the script for you. Fill it in like this:
extends Area2D
# Godot calls this when a body (like the player) touches us.
func _on_body_entered(body: Node2D) -> void:
if body.name == "Player":
# Ask the level (the current scene) to count it.
get_tree().current_scene.add_coin()
queue_free() # remove this coin from the game
Now the score. Open main.tscn and add a CanvasLayer named HUD. A CanvasLayer draws its children on top of the game and ignores the camera, so the score stays in the corner. Give HUD a Label child named CoinLabel with the text "Coins: 0 / 5". Then attach this script to Main:
extends Node2D
@export var coins_to_win := 5 # editable in the Inspector
var coins := 0
# @onready finds the label once the scene is ready.
@onready var coin_label: Label = $HUD/CoinLabel
func add_coin() -> void:
coins += 1
coin_label.text = "Coins: %d / %d" % [coins, coins_to_win]
if coins >= coins_to_win:
coin_label.text = "You win! Press R to play again"
func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("restart"):
get_tree().reload_current_scene()
Drag coin.tscn into the level five times, spread the coins out and press F5. The current_scene.add_coin() line is a shortcut that suits a one-level game. Bigger games send a signal instead.
Add an enemy and a restart
Make an Area2D scene named Enemy the same way as the coin, with a slime picture and a collision shape. Attach a script, connect its body_entered signal and use this code:
extends Area2D
@export var speed := 40.0 # pixels per second
@export var walk_distance := 54.0 # how far it walks each way
var start_x := 0.0
var direction := 1.0 # 1 = right, -1 = left
func _ready() -> void:
start_x = position.x # remember where it started
func _physics_process(delta: float) -> void:
position.x += speed * direction * delta
# Turn around at either end of the path.
if position.x > start_x + walk_distance:
direction = -1.0
elif position.x < start_x - walk_distance:
direction = 1.0
func _on_body_entered(body: Node2D) -> void:
if body.name == "Player":
body.die() # call the player's own die() function
Save it as enemy.tscn and drag one onto a wide platform. Thanks to @export, each enemy copy can have its own speed in the Inspector. Now you can win, you can lose, and R restarts at any time.
Fix the bugs every beginner hits
Errors are normal. When a script crashes, Godot pauses the game and shows the broken line in the script editor. The Debugger panel at the bottom lists each message with its script and line number. These problems cause most first-game trouble:
| What you see | Usual cause | Fix |
|---|---|---|
| The player falls through the floor | The tiles or the player have no collision shape | Paint the physics layer onto solid tiles and give the CollisionShape2D a shape |
| Pixel art looks blurry | Smooth texture filtering | Set Default Texture Filter to Nearest |
Error: Node not found: "Sprite2D" | The name after $ does not match the node | Check spelling and capital letters in the Scene dock |
An error that mentions null instance | A variable points at nothing, often because of a wrong node path | Fix the path, or drag the node from the Scene dock into the script to paste a correct one |
| A coin or the enemy does nothing | The signal is not connected, or the player is not named Player | Look for the connection icon beside the function and check the node name |
| Keys do nothing | The action name in the code does not match the Input Map | Names must match exactly, including underscores |
Copying code from a web page? Replace the whole script at once, because mixing tabs and spaces causes indentation errors. To fix one, use Edit > Indentation > Convert Indent to Tabs in the script editor.
Export your game and share it
Exporting turns your project into a program people can run without Godot. It needs export templates: ready-made copies of the engine for each platform.
- Install the templates. Open Editor > Manage Export Templates. In Godot 4.7 you tick the platforms you want and click Install Selected Templates. The full set is large, so pick only what you need.
- Add a preset. Open Project > Export, click Add... and choose your system, for example Windows Desktop.
- Export. Click Export Project, choose an empty folder and untick Export With Debug. On Windows you get an
.exefile plus a.pckfile that holds your game data. Keep them in the same folder. - Share it. Zip the folder and send it to friends, or upload it to itch.io, a popular site for indie games. With a Web preset, people can even play in their browser, thanks to the Compatibility renderer.
If you are under 18, ask a parent or guardian before you create accounts on game sites. Anything to do with selling needs an adult.
Godot uses the MIT licence. Your game belongs to you, and there are no fees or royalties. The licence only asks you to include Godot's licence text, for example in a credits screen. See Godot's page on complying with licenses.
What to learn next
You now know the core of Godot: nodes, scenes, scripts and signals. Good next steps:
- Animation: swap the Sprite2D for an AnimatedSprite2D and add run and jump animations.
- Sound: add an AudioStreamPlayer2D to the coin and call
play()when it is collected. - A second level: call
get_tree().change_scene_to_file("res://level_2.tscn")when the player wins. - Phones: follow how to make a mobile game in Godot to add touch controls.
- AI help: learn to use AI with Godot without getting broken Godot 3 code.
A game jam, where people make a small game around a theme in a weekend or two, is a fun way to practise finishing. Read game design basics to make your next game more fun, and see what other developers built on our Godot games page.
FAQ
Is Godot really free?
Yes. Godot is free and open source under the MIT licence, with no fees, subscriptions or royalties, even if your game sells well.
Is Godot good for beginners?
Yes, Godot is one of the friendliest engines to start with. It is a small download, opens in seconds and uses GDScript, a language that reads almost like English. It is especially good for 2D games.
How long does it take to make a game in Godot?
This tutorial game takes a beginner about a weekend. A first original small game usually takes a few weeks to a few months of spare time, so start small.
Should I use GDScript or C# in Godot?
Start with GDScript. It is built into the editor, most Godot tutorials use it, and it exports to every platform, including the web, which Godot 4 does not support for C#.
Can Godot make 3D games?
Yes, Godot 4 has a full 3D engine with modern lighting. For a first game, 2D is easier because there is less to set up. Compare engines in Godot vs Unity vs Unreal Engine.
What computer do I need for Godot?
A modest one is enough. Godot's documentation lists 4 GB of RAM and OpenGL 3.3 graphics as the minimum for the Compatibility renderer, on Windows 10, macOS or a recent Linux.
Finished your first Godot game?
Add it to the Mutop100 indie games directory for free. Your game gets its own page, a spot on the Godot engine page and votes from real players.
List your game free