Baltor Get started

Gallery / Godot components

2D platformer controller with coyote time and jump buffer

In your harnessGodot componentMIT

Move a CharacterBody2D like a platformer hero: jump height and time to apex set gravity, early release cuts the jump, coyote time and a jump buffer forgive late and early presses, and ground and air acceleration differ.

Files, names only

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • baltor_test.gd
  • component.json
  • example.tscn
  • inspect_gdscript.py
  • platformer_controller_2d.gd
  • run_tests.gd
  • test_package.py
  • tests/test_platformer_controller_2d.gd
  • verification/native.json

Full files in your harness.

What it takes and gives

Class
BaltorPlatformerController2D, extends CharacterBody2D
Methods
jump_velocity() -> float; rise_gravity() -> float; set_move_axis(axis: float) -> void; press_jump() -> void; release_jump() -> void; can_jump(on_floor: bool) -> bool; step(delta: float, on_floor: bool) -> Vector2
Signals
jumped, landed
Exports
move_speed, ground_acceleration, ground_deceleration, air_acceleration, jump_height, time_to_apex, fall_gravity_multiplier, jump_cut_multiplier and 7 more
Placement
res://baltor/godot_components/platformer_controller_2d/

Limits. Side view with up as -y only; no slopes tuning, wall jumps, ladders or one-way platform drop-through. Gravity comes from the jump settings and ignores the project gravity setting. The apex height matches the design value up to the integration error of the physics step (about 2 percent at 120 Hz in the tests). Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.

Details

Kind
Godot component
Engine
Godot 4.3 or later
Files
12 files, 84.1 KB
Licence
MIT
Declared effects
reads files, runs commands
Checked with
Godot 4.7.2, headless
Checks
godot parse check only, godot gdscript tests, godot tests reject gutted component, godot editor import, godot contract reflection, godot example scene, godot readme usage compiles
Techniques
kinematic jump from apex height and time (g = 2h/t^2, v = 2h/t), coyote time, jump input buffering, variable jump height by velocity cut, semi-implicit Euler integration
Tags
platformer, character controller, movement, jump, coyote time, jump buffer, characterbody2d
Identity
library.supply.creative_originals.df705caca32d544dd4f89a0e.e4836ed61cb85607
Version
e4836ed61cb856071b6df9b0b464dff3e42c629c42b25095117439dcf2e1733c

The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.

Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.