A 2D platformer player controller for Godot 4: coyote time, jump buffering, variable jump height, double jump, air dash, wall slide and wall jump, in one script with its tuning values exposed in the Inspector.
Features
- Running with weight. Acceleration and friction instead of instant speed, with a little less control in the air.
- Coyote time. You can still jump for a moment after running off a ledge.
- Jump buffering. A jump pressed just before you land fires on touchdown.
- Variable jump height. Tap for a hop, hold for a full jump.
- Jump arc tuning. Lighter gravity going up, heavier coming down, a floaty apex, and a capped fall speed.
- Double jump. One extra jump in the air, refilled when you land. Set
max_air_jumpsto 2 for a triple jump. - Air dash. A short, flat burst with a cooldown, once per airtime.
- Wall slide and wall jump. Hold into a wall to slide down slowly, press jump to kick off it. A wall jump gives back your double jump and your dash, so the moves chain.
- One script, no plugins.
scripts/player.gdis the whole controller, about 230 lines with comments.
Requirements
- Godot 4.7 or later, standard build (GDScript only, no .NET needed).
- Tested on Godot 4.7.2 stable on Windows. The controller script uses nothing newer than Godot 4.0, but earlier versions are untested.
- Uses the Compatibility renderer, so it runs on older GPUs too.
Quick Start
- Press F5.
- Run with A and D or the arrow keys.
- Jump with Space, W or Up. Press it again in the air to double jump onto the high platform.
- Dash with X or Shift. Jump the gap and dash at the top of the jump.
- In the shaft, jump into a wall and press jump again to kick off it. Go from side to side to reach the flag.
- Press R to go back to the start.
Known Limitations
- The dash is horizontal only. There is no up or diagonal dash.
- No ledge grab, crouch, or dropping through one-way platforms.
- A wall slide needs you to hold toward the wall. A wall jump works on any wall you touch in the air.
- Air control (70% of
acceleration) and the double jump animation time are fixed in the script, not exported. - Slopes use the default
CharacterBody2Dfloor settings and are not tuned. - The demo character has two frames, so several animations share them.
- Tested on Godot 4.7.2 on Windows only.
License
MIT for the code. See LICENSE.
Third-Party Assets
The character, ground tiles, flag and background are from
Pixel Platformer by Kenney, released
under CC0 1.0. Details in THIRD_PARTY_ASSETS.md, and the
pack's original license is in assets/kenney_pixel-platformer/License.txt.
Learn How It Works
Want to understand how this works instead of just copying it?
CodingQuests teaches you how to build systems like this step by step in Godot, with interactive lessons and real projects.
- Move & Jump
builds the base: a
CharacterBody2Dwith gravity, running with acceleration and friction, a jump, and animation swapping. Free, 3 lessons. - A Jump That Feels Amazing adds coyote time, jump buffering, variable jump height and the gravity tuning. Free, 3 lessons.
- Dash, Double Jump & Wall Jump adds the double jump, the air dash with its cooldown, and the wall slide and wall jump. The first lesson is free.
Source code, integration instructions and issue tracker: https://github.com/CodingQuests/godot-platformer-controller
Changelog for version v1.0.0
2026-10-17 01:04:56
No changelog provided for this version.