I ran into a layer hierarchy issue in cocos2d.
I have a character with sprites for his body parts. The parent sprite of the body is the torso. Then I have hands and a head that are his daughters, then elbows and hands are children of hands. It works very well: I turn my elbow, and my hand turns with him, like on a real puppet.
The problem is when I want to make her worry, her hands drop behind her head, since the head has a higher z-order than the hands (which are the parents of the hands).
So, I added another arm as a child of a torso and turned its opacity ON and OFF depending on whether I need a hand above or behind my head. However, the other hand is not a child of the hand, it is a child of the torso and does not rotate whenever the arm rotates. So, I need to put it manually in each frame.
So my question is: is it possible for the parent sprite of one node to inherit its translation, but draw it over another specified sprite? (e.g., above the other brother of his parent)
Changing the z-order of the hands and head is out of the question, since the animation is exported from another program that does not support these parameters.
Thanks!
source share