This cart demonstrates adding pickups to your game. It is heavily commented so you can pull apart how this is being achieved. (Functions that are already covered in the Movement with Map Collision cart are not commented.)

Notes: This cart uses a function called overlap(a,b) to determine if the player has run into a pickup. Use the Checking For Overlap cart to see how that function works.

The basic idea is that when the player moves, we go through the list of pickups and see if the player's current position overlaps any of the pickups. If they do overlap, we remove that pickup, add to the player's coin score, and play a coin sound.

Install instructions

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


pickups.p8.png 9 kB