void VVBookScene::pageAniDone() { removeChild(curPage,true); curPage = nextPage; nextPage = NULL; reorderChild(curPage,kTag_PageLayer); isActionOngoing = false; curPage->setBookDelegate(this); curPage->onPageStart(); }
void HelloWorld::repositionSprite(float dt) { auto p = m_testSp->getPosition(); p = CC_POINT_POINTS_TO_PIXELS(p); auto map = getChildByTag(1); int newZ = 4 - (p.y / 48); newZ = std::max(newZ,0); map->reorderChild(m_testSp, newZ); }
void wyNode::bringToBack(wyNode* child) { // find out min z order int minZ = INT_MAX; for(int i = 0; i < m_children->num; i++) { wyNode* child = (wyNode*)wyArrayGet(m_children, i); minZ = MIN(child->getZOrder(), minZ); } // set z order of this child to min z order reorderChild(child, minZ); }
void wyNode::bringToFront(wyNode* child) { // find out max z order int maxZ = -INT_MAX; for(int i = 0; i < m_children->num; i++) { wyNode* child = (wyNode*)wyArrayGet(m_children, i); maxZ = MAX(child->getZOrder(), maxZ); } // set z order of this child to max z order reorderChild(child, maxZ); }
void TMXIsoZorderNew::repositionSprite(float dt) { auto p = _tamara->getPosition(); p = CC_POINT_POINTS_TO_PIXELS(p); auto map = getChildByTag(kTagTileMap); // there are only 4 layers. (grass and 3 trees layers) // if tamara < 48, z=4 // if tamara < 96, z=3 // if tamara < 144,z=2 int newZ = 4 - (p.y / 48); newZ = std::max(newZ,0); map->reorderChild(_tamara, newZ); }
void TMXOrthoZorderNew::repositionSprite(float dt) { auto p = _tamara->getPosition(); p = CC_POINT_POINTS_TO_PIXELS(p); auto map = getChildByTag(kTagTileMap); // there are only 4 layers. (grass and 3 trees layers) // if tamara < 81, z=4 // if tamara < 162, z=3 // if tamara < 243,z=2 // -10: customization for this particular sample int newZ = 4 - ( (p.y-10) / 81); newZ = std::max(newZ,0); map->reorderChild(_tamara, newZ); }
int wyNode::reorderChildLocked(wyNode* child, int z) { pthread_mutex_lock(&gMutex); int index = reorderChild(child, z); pthread_mutex_unlock(&gMutex); return index; }