Log In  

Good day, and thank you for looking at this tutorial i put up for the convenience of developers who wish to understand
palt() and how it can be utilized.

the command is used to render colors as transparent when sprites or graphical commands are used. This command also avoids any other edits to the palette that are initiated in the code used.

         

syntax for palt is simple: first parameter chooses color to render transparent or not, second parameter is boolean and decides for the color to be transparent. palt( x , true ) would make the color x not render.

this should be a useful command when using another color as transparency.

I want to show you how sprite packaging [as i call it] can be utilized in pico8, to provide for bigger sprite space for sprites that containt up to 4 colors.

                                                     - Sprite Packaging for 2 color sprites -

The most efficient way i get 4 sprites from one is to stick them together and draw them as if they were different sprites.

-- a should be 1 , 2 , 4 , 8

function sssspr( x , y , w , h , dx , dy , a , c )
for i = 0 , 15 do
--remove unverified colors
if (i/a)%2 < 1 then
palt( i , true ) else
palt( i , false ) end
-- turn verified colors into c
pal( i , flr((i/a)%2)*c )
end
sspr( x , y , w , h , dx , dy )
palt()
pal()
end

I stick colors in a blending program which forces one color to be its next, and this way of combining sprites work very well for me.

           

Cart [#19912#] | Code | 2016-04-19 | No License | Embed
13

And I don't know what else to add but that by using sprite packaging, you can get 512 sprites that have two colors, and 256 for sprites with four.

                                                              - Programs which use this -
                                     TinyTextLS / MinitextLS  https://www.lexaloffle.com/bbs/?tid=3059

ok thanks

                    
P#19916 2016-04-19 04:22 ( Edited 2016-04-19 23:21)

That sprite packaging!! You have no idea how much this helps me! This is great, thank you very much!!

P#19920 2016-04-19 07:20 ( Edited 2016-04-19 11:20)

TinyTextLS and MiniTextLS don't do anything near this interesting, I'm just using subsections of what's already visible. Using colours to overlap multiple layers is genius, very tempted to try and shrink TinyText and MiniText even further with this! I like the name 'sprite packaging' too. Awesome work :)

P#19926 2016-04-19 19:21 ( Edited 2016-04-19 23:21)

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-06-17 07:14 | 0.022s | 4194k | Q:24