Log In  

I would like to use black in my player sprites, how can I remap the color so that, for instance, color 12 is transparent in that sprite instead of black?
Thanks.

P#19809 2016-04-15 21:04 ( Edited 2016-04-16 07:50)

Black is always transparent, so you can't make it opaque at all in Pico-8 currently.

P#19810 2016-04-15 21:44 ( Edited 2016-04-16 01:44)
6

So for my game I changed that instead of black, it uses the beige (color 15) as the transparency. So to have that for the whole game I used this:

function _init()
    cls()

    palt(15, true) -- beige color as transparency is true
    palt(0, false) -- black color as transparency is false
end

But if you only want to change the colors of one sprite itself:

function _draw()
    pal(8,8)    -- here I set red to be red, since I changed it on the other sprite below
    pal(2,2)    -- same here, keeping my purple, purple
    spr(1,40,50)  -- normal sprite drawing
    rst_pal()  -- resetting color pallet

    pal(8,9)    -- changing red to be orange
    pal(2,4)    -- changing purple to be brown
    spr(1,50,50)  -- normal sprite drawing
    rst_pal()   --resetting color pallet
end

-- since I changed my standard color pallet for the whole game I use this function.
Otherwise just use pal() instead of my custom rst_pal() function

function rst_pal()
    palt(15, true)
    palt(0, false)
end

There might be other ways to do this neater, but at least this works for me! I hope this helps :)

Edit: This means my sprites look like this:

The black stays black, and the beige becomes transparent

P#19812 2016-04-15 21:48 ( Edited 2016-04-16 01:55)
1

With pal and palt you have all control over color and transparency in pico8, you can even use them to fade sprites in and out.

P#19814 2016-04-16 03:50 ( Edited 2016-04-16 07:50)

[Please log in to post a comment]