Knockback with weight, exponential decay and stun
In your harnessGodot componentMIT
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.
ATTRIBUTION.mdLICENSEREADME.mdbaltor_test.gdcomponent.jsoninspect_gdscript.pyknockback_receiver.gdrun_tests.gdtest_package.pytests/test_knockback_receiver.gdverification/native.json
Full files in your harness.
What it takes and gives
- 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/
Limits. 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.
Details
- Kind
- Godot component
- Engine
- Godot 4.3 or later
- Files
- 11 files, 73.8 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 readme usage compiles
- Techniques
- impulse accumulation, exponential velocity decay, strength-proportional stun
- Tags
- knockback, combat, stun, hit reaction, physics, action
- Identity
library.supply.creative_originals.dac23fffa05cc05e23cbc32b.2b45e3e62d7cd5c8- Version
2b45e3e62d7cd5c8fb71ed0f8fef463d7576c91faf6197cf16b961f5225fa8d2
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.