The ideal platformer camera should:

minimize vertical motion
lead in the direction the player is facing
remain motionless during horizontal micro-adjustments
The secret to achieving all three is (what I call) the trap. The trap is an invisible rectangle (made visible for this demo), roughly twice as wide and tall as the player sprite, with the same starting coordinates. Rather than follow the player sprite directly the camera follows the trap. When the player moves within the trap, the camera does not move. The trap only moves when the player pushes against one of its edges.

This video includes a visual representation of the Mimeo trap and features three distinct camera behaviors discussed previously: free-moving, zero-lock and platform-snap; each tied to specific regions of the map.

Posted 1 year ago