GameCorder.net

このエントリーをはてなブックマークに追加

Change draw order with zOrder in Cocos2dx

Draw order is defined by added node order.
But it has a time when define draw order nothing to do with added node order.

To do this use node function setGlobalZOrder
Let's see the example


// create Label
auto stageLabel = Label::createWithSystemFont(stage, "Helvetica", STAGE_FONT_SIZE);
// set zorder   
stageLabel->setGlobalZOrder(1);
	

Value _globalZOrder default value is 0.
We want to put stageLabel front set plus value to _glovalZOrder.
for example 1 or more big value.

I confirm version 3.15.1.