GuideBeginner

Godot Engine 101: Your First 2D Game

What is a game engine? why Godot?

May 4, 2026 · 11 min read · updated Nov 14, 2026

Jason • Game Development

Difficulty

Beginner

Time to complete

45 minutes

Before you start

  • ☐ Any device that can run Godot 4.6 (Windows, macOS, Linux, Android)
  • ☐ Basic programming knowledge (variables, if statements, functions)

Overview

This was a thing i made for a workshop in Campfire Jakarta, but its still pretty much a good starting point if anyone is interested in making stuff and need a starting point!

If you only care about building the game, skip ahead to Getting started with Godot.

What is a game engine?

A game engine is a software framework built specifically for making video games. Instead of starting from an empty file, you start with a pile of systems that every game needs anyway:

  • Physics: collision, acceleration, gravity, etc.
  • Graphics renderer: lighting, meshes, pixels, etc.
  • Input/output: audio, controllers, keyboard and mouse
  • Networking
  • Error handling
  • Utility libraries: maths, logging, saving data, and so on

Each of these pieces is the result of decades of people making games and solving the same problems over and over.

Diagram of a game engine split into Game Tools, Game Content and Game Utility packages

Figure 1. A general, abstract architecture of a game engine (Dragan, C. (2017). Simulation and Gaming).

Why use a game engine?

Short answer: making a game from scratch is hard.

  • You have to build every foundation from zero, brick by brick.
  • The development roadmap can stretch out for years.

I learned this the fun way. I once wrote a chess game with an AI opponent in Python and pygame, and it was a lot of work for a board with some pieces on it (commitment issue kek). Compared to it, making a monkey-catches-bananas game in Scratch, which is technically an engine, is so much more easier, and it was done in no time. Even kids can make them.

The middle ground between "from scratch" and "engine" is a framework (pygame, LWJGL, MonoGame, and others). It's easier than doing everything yourself, but:

  • you have to keep an eye on framework compatibility, and
  • it usually still takes more time than a conventional engine, depending on the size of the project.

How deep the rabbit hole goes

To get a feel for what an engine saves you from, take one tiny thing that games do all the time: normalising a vector, i.e. getting the direction of a vector with a length of 1. You divide each component by the vector's length:

v^=(xx2+y2+z2, yx2+y2+z2, zx2+y2+z2)\hat{v} = \left( \frac{x}{\sqrt{x^2 + y^2 + z^2}},\ \frac{y}{\sqrt{x^2 + y^2 + z^2}},\ \frac{z}{\sqrt{x^2 + y^2 + z^2}} \right)

That square root used to be expensive, and games need it thousands of times per frame. So the developers of Quake III Arena wrote this famous piece of code, the fast inverse square root:

c

float Q_rsqrt( float number )
{
    long i;
    float x2, y;
    const float threehalfs = 1.5F;

    x2 = number * 0.5F;
    y  = number;
    i  = * ( long * ) &y;                       // evil floating point bit level hacking
    i  = 0x5f3759df - ( i >> 1 );               // what the f***?
    y  = * ( float * ) &i;
    y  = y * ( threehalfs - ( x2 * y * y ) );   // 1st iteration
//  y  = y * ( threehalfs - ( x2 * y * y ) );   // 2nd iteration, this can be removed

    return y;
}

You don't need to understand it (the original comments make it clear the authors barely did either). The point is that engines are full of tricks like this, and when you use one, someone has already done that work for you. If you are curious, watch Fast Inverse Square Root — A Quake III Algorithm by Nemean.

Engine-built vs. from scratch

Plenty of well-known games are built on public engines:

GameBuilt with
Black Myth: Wukong (2024)Unreal Engine
Hollow Knight: Silksong (2025)Unity
Buckshot Roulette (2023)Godot
Counter-Strike 2 (2023)Source 2

And some famous ones were built on frameworks or completely from scratch:

GameBuilt with
Minecraft (2009)Java + LWJGL (Java Edition), C++ (Bedrock)
RollerCoaster Tycoon (1999)x86 Assembly. Yes, really.

Picking an engine: Unreal vs. Unity vs. Godot

The three engines you'll hear about most:

Unreal EngineUnityGodot
Best atAAA, high-end 3DIndie games, mobile, cross-platform2D, small-to-mid indie games, learning
Learning curveSteep; complex to useBeginner friendly; most tutorials since ~2016 use itVery beginner friendly; nodes are easy to understand
ScriptingC++, plus visual Blueprints (no-code, with limits)C#GDScript (Python-like), C#
WeightVery heavy, both the engine and the games it producesA bit heavyVery lightweight
GraphicsPhysics, lighting and rendering among the best aroundGood, but behind UnrealGreat 2D; 3D behind Unreal
EcosystemBigHuge, long-standing forums and communityHealthy and growing fast; smaller than Unity's
Asset storeYesYes, very accessibleYes (Asset Library), but smaller than Unity's
CostProprietary, royaltiesProprietary; recent pricing/royalty controversyOpen source, totally free, no royalty

None of them is "the best" engine; it depends on what you're making. For a first engine and for 2D, Godot is hard to beat: it's free, small, quick to learn, and you own everything you make with it.

Charts of game engine market share on Steam by games released, units sold and genre, plus public engine growth since 2014

Figure 2. Engine share on Steam in 2024. Unity leads in games released, Unreal and in-house engines lead in units sold, and over two-thirds of public-engine growth since 2020 came from Godot. (Credit: vginsights.com)

Getting started with Godot

That's enough theory. Let's make something.

1

Download Godot

Get the latest version (4.6.1 at the time of writing) from godotengine.org. It's a single small download; there's no installer and no account to make.

2

Get some game assets

We'll use the free Flappy Bird Assets pack by megacrash on itch.io. It has backgrounds, the bird's flapping animation and the pipes.

Other good places for (properly licensed) assets:

Create a new project

Open Godot, click Create in the Project Manager, give the project a name and choose an empty folder for it.

Godot's Create New Project dialog with the project name, path and renderer options

Figure 3. The Create New Project dialog.

You'll also pick a renderer. In simple terms:

RendererWhat it's for
Forward+Desktop only, no mobile. The most advanced 3D features (depending on your setup).
MobileModern mobile and desktop. Simplified rendering as the trade-off for mobile support.
CompatibilityMobile, desktop and web, including older devices. Some features are left out.

For this 2D game any of them will work. You can change it later, but your scenes may need adjusting. The details are in the Godot renderer docs.

A tour of the editor

The Godot editor with its main areas labelled

Figure 4. The main areas of the Godot editor.

  • Scene / node tree (top left): every object in your current scene. This is where you add and arrange nodes.
  • FileSystem (bottom left): your project's files, under res://.
  • Scene tabs (top centre): each open scene gets a tab, like in a browser.
  • Workspace switcher (top centre): jump between the 2D, 3D, Script, Game and AssetLib views.
  • Main workspace (centre): where you see and edit the scene.
  • Inspector / Signals / Groups (right): properties of the selected node. You'll see what this does as soon as you select something.

Project settings

The Project → Project Settings… menu holds everything about the game as a whole: window size, input, rendering, physics, even XR. We'll keep the defaults (a 1152×648 window), but it's worth knowing where to look.

The Project menu open, with Project Settings at the top

Figure 5. Project → Project Settings…

Project Settings, Display → Window, showing viewport width 1152 and height 648

Figure 6. The window size lives under Display → Window.

Building the game

Drag the asset pack's folders into the FileSystem dock first. I keep things organised as Background/, Player/, Tiles/ and a Scenes/ folder for the .tscn and .gd files we're about to make.

1. Main scene and background

Create a new scene with a Node2D as the root and call it Main. Add a Node2D called Background under it, then add two sprites inside that for the background layers (the sky and the city skyline). Save it as Scenes/main.tscn.

The main scene with a sky and clouds background

Figure 7. The main scene with the background layers.

2. The player (with a collision box)

Create a new scene with a CharacterBody2D root named Player. Add:

  • an AnimatedSprite2D: in its Sprite Frames property create new SpriteFrames, then add the four bird frames to the default animation. Turn on looping and autoplay so the bird flaps.
  • a CollisionShape2D with a CircleShape2D that covers the bird.

Save it as Scenes/player.tscn.

The player scene showing the bird sprite with a circular collision shape and its four animation frames

Figure 8. The player: an animated sprite plus a circle collision shape.

3. The obstacle (with collision)

Create another scene with a StaticBody2D root named Obstacle. Add two AnimatedSprite2D nodes for the top and bottom pipe and two CollisionShape2D nodes with rectangle shapes that match them. Leave a gap between the pipes for the bird to fly through.

Save it as Scenes/obstacle.tscn.

The obstacle scene with a top and bottom pipe and their collision shapes

Figure 9. The obstacle: two pipes, each with its own collision shape.

4. Put the player and obstacle in the main scene

Go back to main.tscn and drag player.tscn and obstacle.tscn from the FileSystem into the scene tree. Each one becomes an instance: a copy of that scene living inside Main. Place the bird on the left side of the screen.

The main scene with the bird on the left and a pair of pipes on the right

Figure 10. The player and an obstacle instanced into the main scene.

5. Wall the screen in

So the bird can't fly off the top or drop off the bottom, add a StaticBody2D to Main with four CollisionShape2D children: CollisionShapeTop, CollisionShapeBottom, CollisionShapeLeft and CollisionShapeRight. Give each one a long thin rectangle shape along one edge of the screen.

The main scene with collision boxes along all four edges of the screen

Figure 11. A collision box on every side of the screen.

6. Script the player

Time for code. Select Player, click the attach script button, and use:

  • Language: GDScript
  • Inherits: CharacterBody2D
  • Template: CharacterBody2D: Basic Movement
  • Path: res://Scenes/player.gd

The template already handles gravity and left/right movement. We change the jump so it works in mid-air (it's Flappy Bird, after all) with a short cooldown so you can't just hold the button:

gdscript

extends CharacterBody2D

@export var SPEED = 100.0
@export var JUMP_VELOCITY = -400.0
@export var COOLDOWN = 0.3
var can_press = true

func _physics_process(delta: float) -> void:
 velocity += get_gravity() * delta

 if Input.is_action_just_pressed("ui_accept") and can_press:
  jump()

 var direction := Input.get_axis("ui_left", "ui_right")
 if direction:
  velocity.x = direction * SPEED
 else:
  velocity.x = move_toward(velocity.x, 0, SPEED)

 move_and_slide()

func jump() -> void:
 can_press = false
 velocity.y = JUMP_VELOCITY
 await get_tree().create_timer(COOLDOWN).timeout
 can_press = true

A few things worth knowing:

  • _physics_process(delta) runs every physics frame. delta is the time since the last frame, so the movement is the same speed on fast and slow computers.
  • ui_accept is a built-in input action mapped to Space and Enter.
  • @export makes a variable show up in the Inspector, so you can tweak the jump height or cooldown without touching the code.
  • await ... timeout pauses the function for COOLDOWN seconds, then lets you jump again.

7. Script the obstacle

Now make the pipes move. Select Obstacle and attach a script (inherits StaticBody2D, template Node: Default, path res://Scenes/obstacle.gd):

gdscript

extends StaticBody2D

@export var SPEED := 200.0

func _ready() -> void:
 position = Vector2(1300, 0)

func _process(delta: float) -> void:
 position.x -= SPEED * delta

 if position.x < -100:
  position.x = 1300

_ready() runs once when the node enters the scene, so the pipes start just off the right edge. Every frame they slide left, and once they're off the left edge they jump back to the right to come around again.

8. Game over

Right now, hitting a pipe does nothing. In player.gd, add a check at the end of _physics_process, after move_and_slide():

gdscript

 if is_on_wall():
  print("Game Over")

is_on_wall() is true when the last move_and_slide() hit something from the side, which is exactly what happens when the bird flies into a pipe.

A message in the Output panel isn't much of a game over, so let's make a screen. Create a new scene with a Control root named Screen and add:

  • a ColorRect that fills the screen (any colour you like),
  • a MarginContainer with a Label inside it that says Game Over!.

Save it as Scenes/Game Over.tscn.

A simple Game Over screen: red background with the text Game Over!

Figure 12. The game over screen.

Then replace the print with a scene change:

gdscript

 if is_on_wall():
  get_tree().change_scene_to_file("res://Scenes/Game Over.tscn")

9. Randomise the gap

If the gap is always at the same height, the game gets boring fast. Update obstacle.gd so the pipes start at a random height each time they come back around:

gdscript

extends StaticBody2D

@export var SPEED := 200.0

func _ready() -> void:
 randomize()
 position = Vector2(1300, randf_range(-50, 50))

func _process(delta: float) -> void:
 position.x -= SPEED * delta

 if position.x < -100:
  position = Vector2(1300, randf_range(-50, 50))

randf_range(-50, 50) picks a random number between -50 and 50, which moves the whole pipe pair up or down by that many pixels.

Done

Press F5 (or the play button in the top right), pick main.tscn as the main scene when Godot asks, and play.

The finished game running: a blue bird flying between green and orange pipes

Figure 13. The finished game.

You now have a working 2D game, and you've used most of what you need for bigger ones: scenes and nodes, sprites and animation, collision, scripts, input, and switching scenes.

The finished project is there if you want to compare.

Where to go from here

  • Add a score that goes up every time you pass a pair of pipes.
  • Add a Restart button to the game over screen.
  • Add sound effects for flapping and crashing.
  • Read Your first 2D game in the official Godot docs, which covers all of this in more depth.
  • #godot
  • #gamedev
  • #guide

On this page