Push enemies away from the hit and let the push fade out
A knockback that always goes to the right looks silly when you hit from the right, and one that never stops slides enemies through walls and off the map. Heavy enemies should barely move. This entry covers direction, weight and the fade-out.
Why this works
A push is felt as something that comes from the hit, so its direction must follow the two bodies, and its strength must follow the weight. Letting it fade on its own, apart from walking, makes it look like momentum, not a glitch.
When not to use it
Do not push enemies back in tight spaces or against bosses the player must stay close to, as it breaks the flow of the fight. Use a small flinch or a flash instead, and keep the enemy where it is.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- 23 lines of example code with 3 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Push enemies away from the hit and let the push fade out" (read_entry knockback-away-from-the-attacker) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP