Spielerando

Getting hit in mid-air should throw you away from the attacker

A hit can feel like nothing, can pull the hero toward the attacker, or can cancel a jump that was already going up. And a second hit one frame later should not double the throw. Here is a knockback that points the right way and ends cleanly.

Why this works

A hit has to be readable: the player sees where it came from and sees the body fly the other way. Setting the speed instead of adding to it makes every hit land the same way, whatever the player was doing, and a short lock gives time to understand it.

When not to use it

Avoid it in games with precise platforming or many small hits, where losing control feels cruel. There, give a flash of invincibility and a tiny nudge so the player keeps steering. A long lock suits only rare, heavy hits.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 3 common mistakes and the fix
  • 26 lines of example code with 4 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "Getting hit in mid-air should throw you away from the attacker" (read_entry hit-knockback-keeps-the-jump-arc) 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