Walking (smoothly) in tile-sized increments

Publicado 2024-08-06



This is just a demo of some code to allow walking in tile-sized increments. The hook is that after player input, the player keeps walking until they reach the next tile.

In the first example, the walking tiles are 8x8, though the world is drawn with 16x16 tiles. The hitbox of the player is also only his lower half. This allows the player to be "in front" of things. Walk up to the bottom side of a boulder and walk left and right to see what I mean.

In the second example, the walking tiles are 16x16. The hitbox of the player is also 16x16, meaning the player can only occupy a single 16x16 tile, and can never be "in front" of other tiles.