Log In  

I'm wanting to make a big play area in my game with several cities in it. I made a sprite map of the city (see below) and I want to draw that map in several places. This is working great using map() drawing several times but when you make a change to a map using mset(), it changes it in every location that map is drawn...and that makes sense.

Sooo...is there a way to have a map, duplicate that map, and draw it to be treated as a separate entity/instance in conjunction with mset()

City A, City B, and City C all use the same sprite map but when I use mset() on City A, I don't want it to change B or C.

I'm probably complicating things way more than I need, but I thought using map() + mset() would be better/faster/efficient than managing an object and draw for each building in the city.

P#63027 2019-03-25 20:48

I've got a few ideas on how to do this.

Pico 8 does give you a lot of RAM to work with, but limited map space.

It sounds like you plan to keep your main map in memory. You can either make your own map drawing function to draw sprites from memory (300 sprites a frame isn't a big deal).

Or, you could use a chunking approach, write chunks back to map data when they move between chunks. The NES used to scroll maps like that all the time. You just need to make sure they never see the seam.

Waiting to see what you come up with.

P#63037 2019-03-26 03:43

The whole reason I'm going down this road is because it felt like having a huge table of sprites - one for each building - and looping over it each frame would hit a wall real quick...especially since I don't even have player and enemy objects added yet, also getting looped over.

But, as is usual for me, I'm trying to pre-optimize rather than adjusting when I hit that wall. I should probably just go with the huge table approach and only try to jack with the maps once that fails. Stick with what I know will work.

Thanks for the thoughts and ideas...appreciate it

P#63040 2019-03-26 13:49

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2023-01-30 20:58:55 | 0.005s | Q:11