โ† All examples

godot components

2D platformer controller with coyote time and jump buffer

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.

What this component contains

  • 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

How it works

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/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • 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

Limits to consider

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.