I’m making a strategy game. In the game, all players have the same units, differentiated by army color.
The problem is that I don’t want to make the same texture ten times with ten different colors; instead of that, I want to use ONE texture and tint the sprite by code.
I know that I can change the spriteBatch color or use sprite.setColor. However, that change the color of the whole image, and I don’t want that. The idea is to tint only a part of the sprite, like its t-shirt.
I’ve read about shaders, but I don’t know if they can provide a solution to my problem. Also, I have no idea of shaders xD
I’ve thought that a solution can be split my texture in two textures. One texture will have the immutable colors of my texture, and the other one will be in grayscale, and tinted using sprite.setColor. However I think this is not the best solution.
Ideas are welcome Thanks in advance.