Log In  

So, I'm new to PICO-8 (bought it a few hours ago) and im playing around with a simple open world game (I've called it a GTA test, maybe to use for a clone game in the future.) and i am just wondering how i would go about implementing collision in the map (for buildings and such which haven't been added yet). Is that something

I've used SpaceCat's tutorial so far and added my own camera follow code and made a simple map.

Cart #gtatest-0 | 2024-01-16 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

This is what I have so far, it is literally just the movement code and a simple map

P#140189 2024-01-16 07:25

1

I made a cart in response to an earlier post containing just some very basic collision checks.

Cart #koz_colldemo-0 | 2024-01-02 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

(Hit the "Code" dropdown at the bottom to view the source)

You can read more about it in that post but the idea here is to take a pixel (two really, one for each forward corner) and use mget(x/8,y/8) to get the tile type from the map at each point, then use fget(thetile,0) to check if that kind of tile has flag 0 set (settable in the sprite editor). If they have that flag, we consider it a wall and don't allow the move.

This is pretty basic though, things get more complicated if you want to, let's say, move more than one pixel per frame.

P#140190 2024-01-16 07:41

Thanks heaps! I will check this out later.

P#140193 2024-01-16 08:02

[Please log in to post a comment]