Pixel Movement with Map Collision

This cart demonstrates how to have simple pixel movement that can use the map to block movement. It is heavily commented so you can pull apart how this is being achieved.

Notes: Sprites that you want to be blocking tiles (meaning the player can't walk through them), should have the first sprite flag turned on.

The basic idea is that when the player tries to move, we first check the new location they are trying to move to in both the left/right and up/down directions. If that position has a map tile with a sprite flag of 1 under it, we ignore player movement in that direction.

Install instructions

Save this file to your PICO-8 carts folder. Then load it by typing load pixel_movement in the command line mode of PICO-8.


pixel_movement.p8.png 7 kB