Display-wide shader/color swap?
-
Suppose I have a game with a four color palette, and I want to be able to change what these four colors are without having to perform a replaceColor on every sprite on screen (which at this point in the project, takes about 15 seconds). Is there some kind of filter or shader I can implement on a camera-wide basis that'll change one of the colors into another color I can specify?
-
Tint the camera maybe
FlxG.camera.screen.color = paletteColor;
-
I've done something like that by adding a single-color sprite and setting the blending mode to multiply, but ideally, I'd like to have a more robust palette than light red/red/dark red/black.
-
Have you checked out the Filters demo?
http://haxeflixel.com/demos/Filters/
That kind of seems like what you're looking for.
-
Thanks - looks like matrices are going to be the best shot I have at this. I used the version of it on the HaxeFlixel tutorial, and it's running pretty smoothly. To get better control of the palette, I changed the spritesheet palettes from shades of gray to #F00, #0F0, and #00F, so that I can change them to anything I want. The black/dark gray stays more or less the same, but I can invert the matrix to make it lighter if I want, so this will suffice for now.