Log In  

To allow more room for maps in my current project, I'm planning to use many of the sprites flipped to achieve more visual variety. While I can easily do this for sprites representing the player or enemies, I'm not sure how to implement it for the maps. I don't believe I can use the map() function, even with the flexibility of its layer flags option. I could of course store a table representing the map, with additional flags to indicate whether or not a cell should be flipped, and draw each individual sprite instead of using map(), but I'm worried this will be too slow and generally cumbersome.

Is there a good way to go about this or am I stuck using no flipped sprites for maps? Or should I instead be looking at ways to compress the map data so I can use more room for sprites?

P#19921 2016-04-19 12:49 ( Edited 2016-04-23 01:26)

Maybe you could use the third and fourth page of the Sprite sheets to represent flipped versions of their first and second page counterparts? Advantage: you can use the full map space and effectively have more than 2 pages of sprites. Disadvantage: draw map needs to check the Sprite number so could slow things down. Also, the third and fourth page sprites would have garbage data in them, so they would be difficult to use for drawing the map.

P#19937 2016-04-20 11:08 ( Edited 2016-04-20 15:08)

Thanks for the response.

I'm fairly new to PICO-8, so apologies if I've not recognized the obvious, but your first sentence seems to be contradicted by your last. Is there some way to use the third and fourth pages for functional sprites while also using it to store map data?

P#19947 2016-04-21 11:18 ( Edited 2016-04-21 15:18)

Hi Binaryeye,

Here's a quick and dirty example of the idea.

Cart #19951 | 2016-04-21 | Code ▽ | Embed ▽ | No License

The idea is that the third and fourth pages (sprites 128 to 255) would represent the flipped versions of their counterparts on the first and second pages (0 to 127).

If you use the 2nd half of the map, it puts garbage data into the 2nd half of the sprites (128 to 255). But that would be okay because in the map drawing function they are converted to the correct sprite, mirrored.

P#19952 2016-04-21 13:16 ( Edited 2016-04-21 17:16)
:: NuSan

What I often do, is I use neighbour information to choose what sprite using (like is the left,right,up,down case empty or not) so I dont have to explicitly store a flag. Drawing enough 8x8 tiles to cover the screen is definitly possible, you can also draw the map, and only manualy draw the mirrored tiles needed.

P#19964 2016-04-22 08:34 ( Edited 2016-04-22 12:34)

Thanks, electricgryphon. The example cart makes everything clear. Map editing would be a bit confusing, but I guess that's the price for essentially doubling the space.

P#19971 2016-04-22 21:26 ( Edited 2016-04-23 01:26)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2021-04-16 07:01 | 0.026s | 4194k | Q:31