Situation:
I have two CCSprites they’re child and parent(call them C and P below).
C is a child of P. C is always on the top of the P of course.
Sometime I need to hide the P but show the C,but as you know C should be hiden when it parent hide.
Requirement:
1)C always rendered after P.
2)C always moving by P and scaling by P.
3)C always visible whether the P is shown.
How can I do?
appreciate for your help!
if you hide the parent, all the children will follow. That’s how it works.
If you try C -> setVisible* andP > setVisible**,**P* will also be hidden, whether it is visible or not.
If you try C -> setVisible* andP> setVisible( false )**,**P* will be hidden but C will be visible
re Lance Gray:
thanks for that,but I think you mean C is parent and P is child,that’s opposed with my definition.
whatever, I know how it works(still thanks for expound), but I want to find a way to meet the needs :
1)C always rendered after P.
2)C always moving by P and scaling by P.
3)C always visible whether the P is shown.
OK, I must have read that incorrectly.
For #3 to work, the only solution I can think of is to have P and C siblings. Say you have another object called mainObj. You can then add P and C to mainObj. As I have said, whatever you do with the parent gets applied to its child. If you want P invisible and C visible, you’d have to make them siblings and not parent-child.
It sound like there’s no way to resolve this problem in parent-child and their visible consideration.
I just want to confirm if I miss anything.so now I’ll try other ways like siblings you mention.
thank you very much.