Log In  


When I call map(), only the top layer is drawn. How do I draw all the layers at once? It doesn't seem like there is any parameter to change which layers to draw, but maybe I just haven't figured out which parameter it is.



Try this code:

for i=3,1,-1 do -- replace the '3' with however many layers you have
	-- only giving the first argument in this example, but
	-- you can continue to supply arguments as needed
	map(fetch"map/0.map"[i].bmp)
end

I couldn't figure out how to get mget to target other layers though... :/


@Kaius I think mget might be hard-coded to use 0.gfx... That's a problem because the workaround (indexing the .bmp directly) crashes picotron for me and doesn't show it in the log file.


1

Here's how I've been using mget on other layers.

function mget(x, y, layer, mapfile)
	mapfile = mapfile or fetch("map/0.map")
	return mapfile[layer or 1].bmp:get(x,y)
end

I'm not sure how this works with multiple gfx files, though.


@ooooggll Oh! You can use :get(x, y), cool!

Edit: Yay, it doesn't crash with this! also, you probably want to and it with 0x3fff, to remove the flip bits



[Please log in to post a comment]