My game involves every frame in updating z-order of characters. So it will sort the visual nicely. Please note that it will update every frame.
The problem kicks in when one of player character just disappears. I’m not sure what’s happening.
I also have several other sprites in the game which also get z-order updating. Most of the time problems start from player character, rarely the less of the time it starts from other sprites.
Code to update its z-order is as follows.
float winHeight = CCDirector::sharedDirector()->getWinSize().height;
this->getParent()->reorderChild(this, winHeight - getPositionY() + CHARACTER_LAYER);
And it’s just run through the loop and call the above function.
Any suggestion or some thoughts to solve the problem?