Vlad Pazych
Vlad Pazych

Reputation: 1

How GlobalZOrder works in cocos2d-js?

I have nested tree:

self.addChild(red);
self.addChild(green);
green.addChild(blue);

I get this: (Screenshot)

How can I put blue square behind others, without changing my tree to make it look like this: (Screenshot)

setGlobalZOrder(), does nothing:

red.setGlobalZOrder(2);
green.setGlobalZOrder(3);
blue.setGlobalZOrder(1);

Is there any way of doing this?

Thanks.

Upvotes: 0

Views: 1030

Answers (1)

Vlad Pazych
Vlad Pazych

Reputation: 1

I got the answer on github:

The global z order is affecting only for Sprite objects.

Github issue link

So it didn't work for me, because I was playing with LayerColor.

Upvotes: 0

Related Questions