May 23, 2013

Anyone interested in doing fade-to-black NES style, it's really simple.

If you look at the palette organized as it is typically found on the internet with 4 rows of 16 colors each, each row signifies higher luminosity. Each palette entry can be signified by the hexadecimal equivalent of LH, where L is the luminosity and H is the hue. I'm just pulling color terms out of my ass, but you get the idea.
So palette entry $3A has luminosity 3 and hue 10, the brightest color for that hue. By subtracting $10, you effectively lower the luminosity without changing the hue [much], so that $3A will become the darker $2A.

A safety needs to be included in the code to prevent the palette entry going below $00 and setting the entry to $0D or $0F if it does. This is how you do a simple fade-to-black on the NES. Want to see it in action? Load up CV3 and enter a password; the fade happens between entry screens.

var i;
for (i=0; i<16; i+=1)
{
    pal[i] -= $10;
    if pal[i]<$00
        pal[i]=$0F;
}


Current side project: falling cherry blossoms script

No comments:

Post a Comment

©TheouAegis Productions™. Powered by Blogger.