When an indie dev types how to make a 2d platformer in godot into Google, two problems sit behind the query. The first is engine mechanics: how do you wire a hero that runs, jumps, falls, and lands on tiles that actually collide? The second is the art pipeline: a platformer with an idle, a run, a jump, a fall, a hurt, a coin, and one enemy archetype is roughly twenty-five frames before the hero can leave the first screen. Most hobby projects stall on the frames, not the physics. This guide walks the Godot 4 node tree for a 2D platformer, pins down the jump math that actually feels right, and wires an AI sprite and audio path so the frame tax does not kill the project.
What how to make a 2d platformer in godot searchers actually want
DataForSEO lists how to make a 2d platformer in godot at 50 searches per month with a Keyword Difficulty of 0 (verified 2026-10-01 in tools/research-supplement.md). Neighbor phrases like godot 2d platformer tutorial, how to make a platformer in godot, and godot platformer jump sit in the same cluster, so one honest how-to on the “in Godot” path answers them all without a second cannibalizing post.
The audience is narrower than the Scratch or Unity equivalents. These are devs who already installed Godot — stable release 4.7.2, shipped August 18, 2026, per the Godot engine Wikipedia page (verified 2026-10-01) — and they already made the cat-moves-with-arrow-keys demo. They want the next step: a proper platformer loop with gravity, variable jump height, a tilemap, and the kind of coyote time that keeps the controls from feeling cheap. For a general-purpose Godot 2D intro, see the sibling post how to make a 2D game in Godot. This page is specifically how to make a 2d platformer in godot — the jump-loop angle.
The platformer loop in Godot 4's node tree
Godot organizes a game as a tree of nodes grouped into reusable scenes (confirmed on the Wikipedia Godot entry above). A minimum 2D platformer runs on a tight set of nodes. The scene tree looks like this:
- Level (Node2D) — the root.
- TileMapLayer — the dungeon or forest geometry; one layer per visual pass (background, collision, foreground).
- Hero (CharacterBody2D) — a kinematic body with
move_and_slide; the hero's physics live here.- AnimatedSprite2D — plays the idle, run, jump, fall, and hurt frame strips.
- CollisionShape2D — a capsule or rectangle that defines the hero's physical bounds.
- Camera2D — follows the hero with a soft-smoothing lerp.
- Enemies (Node2D group) — a parent node holding each enemy as its own CharacterBody2D.
- Pickups (Area2D) — coins, keys, and jump pads register as areas, not bodies, so the hero passes through them while triggering a signal.
- UI (CanvasLayer) — HP hearts, coin count, and a pause overlay rendered above the world.
Godot 4 replaced the old KinematicBody2D with CharacterBody2D and promoted move_and_slide to a method that reads a built-in velocity property, so the input loop reads tighter in 4.x code than in 3.x tutorials. If a tutorial you are reading still passes a velocity argument into move_and_slide(velocity), it is 3.x code — stop and find a 4.x source, because the signatures diverged.
Lock a hero sprite sheet before you open the scene editor
The art pipeline is where platformer projects die. Before you drop a single node, decide the hero animation set. A minimum 2D platformer sheet that still reads as polished looks like this:
- Idle — 4 frames, breathing loop.
- Run — 6 frames, side-view cycle.
- Jump — 3 frames: crouch, takeoff, airborne.
- Fall — 2 frames, airborne descent.
- Hurt — 2 frames, knockback flinch.
- Attack — 3 frames if the hero has a melee, optional.
- Coin or pickup — 4 frames, rotating.
- Enemy archetype — 2 idle, 4 walk, 2 hit — 8 frames.
Count the frames and a minimum sheet lands around twenty-eight. That is a weekend of pixel art if you hand-draw every frame. The AI sprite path on Sorceress collapses it into a credit-costed afternoon. Name files before you leave the generator — hero-idle-01.png, hero-run-01.png, and so on — because Godot's AnimatedSprite2D imports frames in file-name order and messy naming becomes messy animation at play time.
For sibling framing on the sheet-before-code habit, see how to make a sprite sheet and the Godot-specific sprite sheet for Godot write-up. Both bake in the same discipline this section wants.
CharacterBody2D jump math that feels right
A platformer jump is not velocity.y = -400. It is a derived number from three design choices: how high you want the apex, how long you want the hero in the air, and how fast gravity should pull them back. Pick the apex in pixels and the time to apex in seconds, and gravity falls out of the equations.
The physics come from the platform game genre's standard model (verified 2026-10-01 on Wikipedia). The jump height is h, the time to apex is t_a, the gravity is g = 2h / t_a^2, and the initial jump velocity is v_0 = -2h / t_a. Pick h = 96 pixels (three tiles at a 32-pixel grid) and t_a = 0.35 seconds and gravity becomes roughly 1568 pixels per second squared and jump velocity becomes roughly minus 549 pixels per second. Those are game-feel numbers, not textbook numbers — tune them.
In GDScript on a CharacterBody2D node:
extends CharacterBody2D
const JUMP_H := 96.0
const JUMP_T := 0.35
const GRAVITY := 2.0 * JUMP_H / (JUMP_T * JUMP_T)
const JUMP_V := -2.0 * JUMP_H / JUMP_T
const RUN_SPEED := 180.0
var coyote := 0.0
var jump_buf := 0.0
func _physics_process(delta: float) -> void:
velocity.x = Input.get_axis("left", "right") * RUN_SPEED
velocity.y += GRAVITY * delta
coyote = max(0.0, coyote - delta)
jump_buf = max(0.0, jump_buf - delta)
if is_on_floor():
coyote = 0.1
if Input.is_action_just_pressed("jump"):
jump_buf = 0.1
if jump_buf > 0.0 and coyote > 0.0:
velocity.y = JUMP_V
coyote = 0.0
jump_buf = 0.0
if Input.is_action_just_released("jump") and velocity.y < 0.0:
velocity.y *= 0.4
move_and_slide()
Coyote time (the 0.1-second window after walking off a ledge during which a jump still fires) and jump buffering (the 0.1-second window before landing during which an early jump press still fires on landing) are the two single most impactful quality-of-life tweaks a platformer can ship. Variable jump height — cutting velocity.y to 40% on button release — is the third. Without those three, the hero controls will feel cheap no matter how good the art is.