I am stuck with the problem of layer hierarchy in cocos2d.
I have a character with sprites for its body parts. The parent sprite of the body is the torso. Then I have arms and head that are the children of it, then elbows and hands are children of the arms. It works very well so far: I turn the elbow and the hand is turning with it, just like on a real puppet.
The problem is when I want to make it wave, the hands get behind the head since head has a higher z-order than arms (which are parents of the hands).
So, I added another hand as a child of torso and turn its opacity ON and OFF depending whether I need the hand above or behind the head. However, another hand is not the child of the arm, it is a child of the torso and doesn't rotate whenever the arm is rotating. So, I need to position it manually each frame.
So my question is: Is it possible to parent the sprite of one node to inherit its translation, but draw it above the other specified sprite? (like above another sibling of its parent)
Changing z-order of arms and head is out of question since the animation is exported from another program which doesn't support these parameters.
Thank you!