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.

P#145698 2024-04-04 18:58 ( Edited 2024-04-05 02:12)

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... :/

P#145708 2024-04-04 20:30

@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.

P#145841 2024-04-05 20:46
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.

P#145844 2024-04-05 21:10

@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

P#145846 2024-04-05 21:13 ( Edited 2024-04-05 21:15)

[Please log in to post a comment]