|Topic was automatically imported from the old Question2Answer platform.
I have a character built from four individual graphics (body, legs, head, ears), and they are all red. In the settings the users should be able to choose from different colors via checkboxes, so let’s assume they tap on green…
I’d like the character to instantly swap colors and I assume that’s doable. My beginner-mind thinks of a folder containing sub-folders in each of which the same four character-graphics are being stored in their respective color. For the game itself (“in the memory”) there is a folder with the currently used graphics, currently filled with the red ones. Changing to green would erase these red versions and instead copy the green versions in place. (The idea is to have the single graphics always to be named the same although coming from within different color-folders, so the code wouldn’t mind…)
Would that be a good way to do this?
I’m not totally sure what you have done, but assuming you have sprites for the body, legs etc. then perhaps use the modulate function on the sprite. When I do something similar, I just use white sprites and then set the color like this:
var green = Color(0.2, 1.0, 0.0, 1.0)
var red = Color(1.0, 0.0, 0.0, 1.0)
$Sprite1.modulate = green
$Sprite2.modulate = red
Hope it helps or others chime in with the solution for you
Thanks for your suggestion. I thought about pointing out that modulating isn’t an option in this case, now I know that I should have, sorry, but thanks anyway!
In my case I’m using individual sprites because they all base on their own hand made original. And I generally am interested in how to approach such a case, with emphasis on the loading/erasing aspect. I think I could load all the versions with all individual names and then organise them in code, but that would be lots of manual work (and data), so I was wondering if the idea of one folder for the current version makes sense in the first place.
I don’t dare asking about the how before the comunity greenlights the if ; )
pferft | 2020-09-08 13:50