โ† All examples

godot components

Knockback with weight, exponential decay and stun

Add knockback from hits divided by weight, fade it with exponential friction, and stun in proportion to the hit strength with a cap, so heavy enemies barely move and light ones fly.

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • baltor_test.gd
  • component.json
  • inspect_gdscript.py
  • knockback_receiver.gd
  • run_tests.gd
  • test_package.py
  • tests/test_knockback_receiver.gd
  • verification/native.json

How it works

Class
BaltorKnockback, extends Node
Methods
apply_knockback(direction: Vector2, strength: float) -> void; advance(delta: float) -> Vector2; get_velocity() -> Vector2; is_stunned() -> bool; get_stun_left() -> float; clear() -> void
Signals
knocked, stun_ended
Exports
weight, friction, min_speed, stun_per_unit, max_stun, auto_advance
Placement
res://baltor/godot_components/knockback_receiver/

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_readme_usage_compiles

Limits to consider

Owner-driven: it computes a velocity to add and does not move anything. 2D vectors. The stun is a timer only; animations and AI pauses are up to the owner. Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.