Hi all! I have a question about the best way to structure a game object comprised of multiple modular sprites.
I have a base spritesheet that is animated frame-by-frame via a script. I also have several optional spritesheets, with the same animation frames, that should be drawn over the base sprite. Each is a different hairstyle or outfit that characters in my app might have. Because of the frame size of these animations, all these sprites cannot fit in one atlas (it’s not a pixel art style). Spine isn’t an option because the animations are drawn traditionally.
What would be the best way (for performance, ease of modification in the future, and general ‘best-practiceness’…) to unify all of these atlases into sprite objects inside a go or collection so that I could write a simple function – setAppearance(hair#, hairColor, outfit#, outfitColor, ...)
– that will them toggle on or off?
The approaches I’ve considered so far are:
- Include a different sprite component for each atlas – hair1, hair2, hair3 etc – inside the main character go/collection, then enable or disable them in
init()
- Make gameobjects for each individual hair and outfit style, then create a factory for each inside the main character go/collection. Use
factory.create()
on the appropriate hair and outfit factories for the desired hair, outfit, etc. - Maybe there are other options I’m not experienced enough to know about!
I found a few old threads that have similar questions, but no definitive answer that fits my situation 100%. I’m a little hesitant to move forward since it will be a lot of setup work, so I want to make sure I’m headed down the right path first! Any advice will really be appreciated