An enemy that leaps at you and lands where you will be
Enemies that jump are either harmless, because they land where you were, or they cheat with a straight line through the air. A real leap has an arc with a peak you choose. Here is how to compute it so the enemy comes down on a target that keeps moving.
Why this works
A leap is a fall with a chosen top. Once the peak is picked, the time in the air is fixed no matter how far the target is, so the enemy can aim at the spot where a moving player will be, and the jump looks like real physics instead of a cheat.
When not to use it
Wrong when the player should always be able to dodge by changing direction late; a perfectly led leap is unfair. Then aim at the current position, or lead only part of the way, so a sudden turn still escapes it.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- A diagram of every state
- 22 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 "An enemy that leaps at you and lands where you will be" (read_entry enemy-leap-lands-on-a-moving-target) 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