PICO-8: Movement with Map Collision
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.
Status | In development |
Platforms | HTML5 |
Rating | Rated 5.0 out of 5 stars (1 total ratings) |
Author | MBoffin (Dylan Bennett) |
Genre | Educational |
Made with | PICO-8 |
Tags | PICO-8, sourcecode |
Download
Download
pixel_movement.p8.png 7.9 kB
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.