Hey guys, I’m doing a game where I need to add ALOT of customization to the player’s avatar and wasn’t quite sure of how to do this. What I was thinking was making the avatar sprite with starting clothes then just layer new sprites over it as new items are bought, but I was thinking would I need to make different animations for every single piece of added clothes as the avatar moved?
We didn’t use Cocos2D for My Pet Zombie, but I’ll explain our general methodology as it should be something you can map to Cocos2D.
We have an underlying skeleton for the character, this is each of the individual parts – torso, head, upper arm, forearm, hand, etc. Our animations defined where each of those limbs should go as they move around.
The “attachments” for each of the clothing options are then attached as a child to the appropriate object on the skeleton. So a new hairdo is setup as a child of the head. Some objects like shirts have multiple pieces each attached to the appropriate body part. By setting them as a child of the body part, they automatically move with the body part and don’t need to be individually animated.