Spielerando

Make a patrolling enemy turn at the ledge instead of walking half off it

The guard marches along a platform and either drops off the end or hangs in the air with half its body over nothing. Here is where to look for the ground ahead, what happens on a platform too small for it, and why fast enemies can still skip a gap.

Why this works

A body has width, and it falls when its leading edge leaves the ground, not its middle. Looking at the spot just ahead of the front, in small steps, makes the guard turn in time and never skip over a narrow hole.

When not to use it

Don't use it for enemies that are meant to fall off, jump gaps or hop between platforms, such as a charging beast or a jumper. For those, make the edge a decision point: sometimes turn, sometimes jump.

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
  • 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 "Make a patrolling enemy turn at the ledge instead of walking half off it" (read_entry patrol-turns-before-the-edge) 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