A hero drawn in four directions flickers when you walk diagonally
When the pictures only exist for up, down, left and right, a diagonal walk has to pick one. A naive pick flips back and forth with every tiny wobble of the stick, and the hero looks nervous. Here is the rule that keeps the look calm without making turns feel late.
Why this works
A diagonal has no right answer between two looks, so tiny shaking decides it at random. Giving the current look a head start means the sprite changes only when the player clearly means another way, and a sloppy thumb cannot flip it.
When not to use it
It is the wrong tool when the art has eight facings, where a diagonal has its own picture. Pick the nearest of the eight there, and if the hero should look at a target, point it at that instead.
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
- 13 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 "A hero drawn in four directions flickers when you walk diagonally" (read_entry rpg-four-way-facing-from-diagonal) 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