I want to allow players to change a character's hair and clothing styles, and select colors for them. This means I need to have separate styles for said hair and clothing, and have the game put them together, then change the color values based on the player's selection and keep those color values unless the player decides to change their selection later.
Am I going to need separate sprite sheets with all the possible style combinations, or can it overlay the sprites on top of each other and treat it as a single sprite, which would let me have hair styles and clothes in separate sprite sheets from the main sprite for easy switching?
Also, how do I get it to change the colors based on the color values of the pixels? For example, lets say I have a base sprite that uses RGB 150,150,150 for normal parts of the sprite, and 100,100,100 for parts that are supposed to be darker, like say the leg further away from the player when the sprite is walking. A player selects purple for the clothing color, so I want the sprite to be changed so the first color is 120,40,120 and the second color is 100,20,100. How do I get it to do this?
Sorry if it doesnt make sense Im kind of new but this worked for me before.
I see two ways: making variants for each cloth and place them on top of your character starting invisible. So if hat=1 make it visible and the others invisible. And so on...
Another option: if hat=1 spawn object on player.Y,player.X and destroy the other objects. But you will have to get a lot of coordinates. The first method is the easiest.
If anyone got a better method...
Thank you for the advice, that could work. I don't need to really change colors during the middle of things happening, only put the sprite together from different pieces, then color them, then the result gets used throughout. It only needs to change if the player goes to the menu and changes options. I just need to get it to do this in the first place.
The way I did it was making a variable called Hat (my game uses hats) and attach a number to them
So, on the game layout, on start of layout, compare variable -
hat=1 Set hat skull visible.
set hat eye invisible
If hat=2 set hat Eye visible
and so on.
And on the main menu or shop:
If coins>500 set hat=1
set hat skull opacity to 50 (to underline that is selected)
Hope it helps! :)
It does, I just still need to figure out how to set color values in game as I said.
Develop games in your browser. Powerful, performant & highly capable.
Mmmm... I'll just have to make different colors of everything I guess and have the game draw the sprites atop the base. This is somewhat aggravating, but otherwise I have to make my own plugin to manipulate the images and I think that will take more time and effort than making the recolored sprites.
I just don't like doing this, because there are 10 races, each with its own base sprites. Assuming 16 possible colors, that's 160 different sprite sheets, 320 since there are male/female variations of each. Then I have to make eyes, head accessory styles (hair styles for humans for example) and body accessory styles (clothing for humans again). That's 3 more sprite sheets for each, and even if the eyes can be much smaller, we're talking 1280 separate sprite sheets for the 10 races.
That is precisely why I didn't want to have to do that... that's a LOT of art to load. Even at around 15 or 16 kb per sheet of 64x64 sprites, that's already 19 MB... before I add ANY other art into the game. Even assuming I manage to make the other sprite sheets 8x8 to cut down file size, it's a lot of resources and I've gotta consider all the other things that will be in the game.