Hope this is the right place to post this. First time programmer, and I've been having a ton of fun trying to make a game in PICO-8.

I've been following Lazy Devs excellent Roguelike tutorial series on YouTube, but I've been running into a consistent issue.

For my game, I decided to make my player sprite 16x16. However, Lazy Devs' tutorial (and most of the ones I've seen online) assume an 8x8 character sprite. This is specifically giving me grief when it comes to collision. Right now, my player bounces off the walls on the top of the screen, and ignores collision entirely when moving left into them.

From what I can gather, the collision on a 16x16 sprite is calculated from the top left tile. Ideally, I'd love collision to be calculated from the bottom two tiles on the sprite. What's the best way to adjust/offset my collision to account for a larger sprite?

I've attached my cartridge to this post. If someone could point me in the right direction, that would be much appreciated.

P#143074 2024-03-15 09:25

Welcome, this is the right place to post.
1st, you have to decide if your 16x16 hero moves by steps of 1 tile or 2 tiles.
If everything is on a grid of 16x16 tiles, then your left border is too thin, when checking if you can walk left, the check lands outside the map and you character walks thru the wall. Only the top left square of each 2x2 is checked.
This also means that p_x should be initialised with an even number, to be properly placed on the grid. Use a temporary 16x16 checkerboard floor to help you notice tile alignement problems.

You could also decide that your character moves by steps of 1 tile, even if it's a 2x2 tile sprite. If so, there are two tiles you have to check before moving.

Cart #zonayajefa-0 | 2024-03-16 | Code ▽ | No License

P#143122 2024-03-15 14:50 ( Edited 2024-03-16 00:04)