Log In  

Cart #fmc-0 | 2019-12-28 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3
TO LOAD THIS CART in Pico-8, type:

load #fmc

Pico-8 has the ability of setting any of 8-flags for a single tile or sprite from the spritesheet.

For instance, if you created a sprite which was the very first, number 0, and turned on flags 1 and 2, then if you used FGET(0) you would get back 3 as each flag counts as a power of 2, binary.

So this program is pretty powerful what it does.

It will return ALL collisions of a sprite around objects and return their flags. For instance in this example you can easily cross over tiles that have no flags set or the first flag is set (the shazy tiles), but it will not let you cross any tiles that have the 2nd or higher flags set, a wall.

If you are already on top of a tile that has the first flag set and attempt to then cross over into a tile that has the second flag set, you will get back the value 3 and movement will still be prohibited.

This collision function also allows free movement, that is you do not need to jump from one tile to another in steps of 8-pixels nor do you need to move only along a tight 8x8 grid. No, in fact you can freely move including diagonally and slide right along the walls into openings and out of and still return the correct values for collision.

HOPE THIS HELPS !

P#71476 2019-12-28 20:02 ( Edited 2019-12-28 20:03)


[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-08-08 09:29 | 0.016s | 4194k | Q:28