Log In  


Hi,
Currently toying around with Picotron basics after some (but not too much) prior experience with Pico8.
I'm trying to work with multiple layers and some degree of transparency between them but it's not quite working.

In the map screen, nearly all tiles are in the lowest layer; the top layer has only the single mushroom sprite on the far right. My assumption is that the default black in subsequent layers would act as transparency. I swear I had this working previously but am having trouble recreating it -- when I actually run the cart, the black of the upper layer acts as just solid black, only rendering the mushroom but nothing of the layer below (wizard character drawn at runtime).

Based on Pico8 docs, I've got a palt(0, true) in my _init() with the understanding it should turn black to alpha, but it seems to make no difference. I also see that black should certainly act as the transparent color by default anyway?

Anyone know what I'm doing wrong? Swapping layers renders that grassy layer as expected, with the lower layer (mushroom) totally hidden.

Running 0.1.0d on Arch Linux (x86).
Thanks.

1


Try this code:

for i=2,1,-1 do -- replace the "2" with however many layers you want to draw
	map(fetch"map/0.map"[i].bmp)
end

From a little testing, map() without any arguments (or only numerical arguments) only draws the top (first) layer; if you want to see the other layers, you have to manually draw them one by one, which requires using fetch to get the .map file, indexing the resulting table by what layer you want, and then indexing that table by the key bmp to get the tile data as a 2D userdata, which then is used as the first argument to map.


1

Interesting, thanks! Looks like it's doing the trick. Seems to be another point where relying on the Pico8 API isn't very safe.

Looking through other community resources, map() is definitely not quite right yet.
https://github.com/Picotron-Software-Developers/Picotron-Wiki/pull/8



[Please log in to post a comment]