Oskuro
|
 |
«
Reply #7 - Posted
2012-07-26 15:43:39 » |
|
The complexity when recoloring sprites really depends on how much color variation goes into it.
If the color variation is simple (For example, each section only has dark, normal and bright colors), you can just draw and color the sprite normally, and then programatically recolor each section (as you know the base colors beforehand).
For example, let's say you want to recolor your Space Marine's armor and pants, so you draw the sprite normally, paint the armor green (RGB: #00FF00) and the pants blue (RGB: #0000FF), with the three color intensities being percentages (Dark 25%, Normal 75%, Bright 100%). Of course you have to make sure the rest of the sprite does not use any of these values
Now, when the player decides the Space Marine desperately needs a pair of hot pink pants (RGB: #FEBFEF), your program needs to look for all the Dark Blue, Normal Blue and Light Blue pixels, and replace them with the corresponding Hot Pink values.
Alternatively, use indexed color, and alter the palette in game. Or maybe save your sprite images with two layers: Color and Brightness (Grayscale), then alter the colors and multiply by the brightness layer.
There are plenty of ways to handle this programatically. One recommendation I'd make, though, is that, unless the colors need to change during gameplay (In which case palette swapping might be the way to go), make sure to pre-generate the recolored sprites during the loading phase on a per entity basis, for performance's sake.
|