Log In  

I've played around a lot with using sspr() to palette shift custom areas of the screen, so I thought I'd share a function for doing so over a circular area. It's also what led me to make this suggestion here https://www.lexaloffle.com/bbs/?tid=48796 It's not essential to any of my projects right now but I figured I'd call a bit more attention to it.

function ssprcircfill(x,y,r)
pal(split"0,0,0,2,13,2,5,4,8,9,3,1,6,9,14")
poke(0x5f54,0x60)
    for i=0,r do
        for op=-1,1,2 do
            local height,lefx=640*sqrt((r/320)^2-(i/320)^2),x-i*op
            local top=y-height/2
            if top<=0 then
                height+=top
                top=0
            end
            height=min(height,128)
            sspr(lefx,top,1,height,lefx,top,1,height)
            if(i==0)break
        end
    end
    poke(0x5f54,0x00) pal()-- return to defaults
end 

To change what colors are shifted to what, just change the numbers in the pal function!

P#115422 2022-08-08 04:18


[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-19 22:25:18 | 0.005s | Q:11