# Animating a sprite character with Multiple Parts

I'm trying to animate a 2D character with interchangable parts. Right now, I have each part nested in a general part that is in turn nested in an overall parent like so; Player->Heads->Head1. I have a Controller for each part made and I feel like I should be able to pass the parameters from the Player's animator all the way to Head1's animator as they have the same parameters. I'm not quite sure how to tackle this. Using C#

My own personal way of handling this would be having the Player contain each directly connected part of the body, and so when the player is called to update, you then update each part of the body within that.

A quick example, lets assume that your objects will handle their own rendering.

RenderPlayer()
{
//Player Render code here
this.Arm.RenderArm(PlayerX,PlayerY);
}


With this each Object only needs to know its location compared to the player, and add that to the location information the player passes on. You can also continue to nest this even farther down.

RenderArm(X,Y)
{
//Arm Render code here
this.Hand.RenderHand(ArmX + X, ArmY + Y);
}


The player does not need to know the arm has a hand, so you could add even more, like if the hand has a weapon or the like. You have to factor in offsets of course, but hopefully this will help your creation of something "Rayman like"

It also means that if you swap one head for another, it doesn't need anything special to work, since it fills the same mold.