Log In  

Cart #yedomewuka-3 | 2020-06-14 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Hello PICO-8 Community!

Attached is my first attempt at programming a video game (I have done a lot of statistical programming, but this is way different). Currently I am having some problems with Maps and collision detection in this particular game.

Setup: Flag 0 are things you can stand on, Flag 1 are things that you can't jump through.
Problem: Whenever I start the map, I hit an invisible wall next to the tree trunk, on both sides and you can jump on some of the tree that are not able to be jumped on.

Could someone look at my code/map and see if there is something wrong with my collision detection or map construction.

Thanks,
HBHR Jelly

P#78050 2020-06-14 02:03 ( Edited 2020-06-14 23:19)

I believe your bug is in collide_map in the code:

        --pixels to tiles
        x1/=8   y1/=8 y1/=8 y2/=8

y1 is repeated. x2 is absent.


Although fixing that fixes most of the problems, even with that corrected I can stand in mid-air in this position:

I'm going to leave that one for you or someone else to track down. :p

P#78058 2020-06-14 06:17 ( Edited 2020-06-14 06:33)

Hi HBHR_Jelly! I recognise that code from the Nerdy Teachers tutorial :)

As for the error that remcode pointed out, looks like it was a rogue map tile at X014, Y013 (you can see it with a grey dot in the top-left corner in the map editor). Delete that tile and you're golden!

Look forward to seeing your game continue – have fun!

P#78060 2020-06-14 09:49
1

Thanks to both both @daddynewts and @remcode. that has fixed my problem!

P#78076 2020-06-14 18:07

[Please log in to post a comment]