#orange-chair101
Explore tagged Tumblr posts
snailmakesgames · 5 months ago
Note
Hey, bro, I really like the NES game you submitted for the game jam. As I'm new to coding and eager to learn, I wanted to know how you did the fade-away effect, where the colour palette almost changes likeit does on the original NES. Looking forward to hearing from you, and best of luck with the jam!
Heya! Thank you so much :)
The way I handled the color palette effect was actually done entirely inside a shader! In my main gameplay scene - a node that handles everything at the top level, like level transitions, restarting the game, keeping track of hp/score, etc. - I have a CanvasLayer node with a ColorRect set to cover the whole screen:
Tumblr media
This ColorRect has a shader material applied that locks the colors on-screen to the nearest color within a palette I set from an image file. I also have the filter CanvasLayer set to Layer 128 just to be extra sure it takes priority over everything. Then for the transitions themselves I actually just have a pretty standard fade in/fade out animated using an AnimationPlayer - all the magic comes from keeping to that palette! You can see it's just a normal smooth fade without it:
Tumblr media Tumblr media
So it's the same concept as palette cycling, just without an actual indexed palette being manipulated.
I'm so not the person to teach about shaders as I only barely understand them myself, but you can find a shader that does this here and a Heartbeast tutorial on shaders over here!
3 notes · View notes