Currently, I get confused by the zOrder of of CCSpriteBatchNode’s children.
I am developing a game, which needs to bring the target sprite to the most front.
I tried to use setZOrder(int) method, but it seems not work every time.
I then went through the code, and found the following lines:
void CCSpriteBatchNode::reorderChild(CCNode **child, int zOrder)
CCAssert, “Child doesn’t belong to Sprite”);
**if (zOrder == child->getZOrder())
//set the z-order and sort later
Those code in the middle prevent my programme to executing “CCNode::reorderChild(child, zOrder)” all the time, since I have changed the value of ‘m_nZOrder’ of the child…
I cannot figure out the significance of those code, which do not exist in the method of ‘CCNode::reorderChild(CCNode *child, int zOrder)’.
Now I have to use ‘getParent()->reorderChild’ instead of ‘setZOrder’.
Could you tell me why CCSpriteBatchNode is designed to be like this, plz.
Thanks a lot. I am very grateful to your team and the your masterpiece, the cocos2d-x.