Spielerando

The camera sticks at the map edge, or keeps pushing when I turn away

When the camera runs into the edge of the map and you keep holding a diagonal key, one direction should stop and the other should carry on along the edge. Often the camera stops dead, or hidden speed makes it linger before it reacts. Here is how to stop one direction at a time and how to slow down before the edge.

Why this works

A wall should stop only the part of the movement that points into it. Treating each direction on its own lets the rest carry on along the wall, and cancelling the stored speed at the wall means nothing is left to pull the view back later.

When not to use it

Do not slide when the edge is meant to feel like a hard limit, such as the end of a level or a ring where leaving has a cost. Then stop all movement with a clear signal, or let the world wrap around instead.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 3 common mistakes and the fix
  • 33 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 "The camera sticks at the map edge, or keeps pushing when I turn away" (read_entry strategy-slide-along-map-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