Camera Follow

This cart demonstrates how to get the camera to follow the player. It is heavily commented so you can pull apart how this is being achieved.

Notes: The basic idea is that the camera always shows a 128x128 block of pixels, usually starting at pixel coordinate 0,0. But you can use the camera() function to change which pixel the camera starts at if you want to show a different block of 128x128 pixels, such as, say, the block of pixels centered around the player. This cart uses the mid() function to ensure the camera doesn't go too far and show area that's off the map.

StatusIn development
CategoryOther
PlatformsHTML5
Rating
Rated 4.8 out of 5 stars
(4 total ratings)
AuthorMBoffin (Dylan Bennett)
GenreEducational
Made withPICO-8
Tagsfantasy-console, PICO-8, sourcecode

Download

Download
camera_follow.p8.png 8 kB

Install instructions

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