Map-Based Grid Movement

This cart demonstrates simple map-based grid 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 store the coordinates of where they are trying to go. Then we check those new coordinates to see if the map tile in that spot has a sprite flag of 1 or not. If it does, we just ignore the player's attempt at moving. But if it doesn't, we change the player's location to the new coordinates and play a footstep sound.

StatusIn development
PlatformsHTML5
Rating
(1)
AuthorMBoffin
GenreEducational
Made withPICO-8
TagsPICO-8, sourcecode

Install instructions

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

Download

Download
grid_movement.p8.png 7 kB