-
pabitrapadhyLikes 2Problem Description
Hi
we know, when we run a game we create a scene object and an object of the class added as child to that scene object like this-
Scene * HelloWorld::createScene()
{
auto scene = Scene::create();
auto layer = HelloWorld:;create();
scene->addChild(layer);
return scene;
}
Now, firstly the object of HelloWorld class is added as a child to the scene object.
Say, If I have 3 sprite objects created inside init() of HelloWorld and these need are added as child to the object of HelloWorld
My Question –
1. If I am not specifying any zOrder while adding them as child, how will be they added ? (A graphical answered is greatly appreciated)
2. How the in-order traversal of nodes are working in cocos2d-x works.3, Is that tree to which the nodes are added as child is a binary tree.. ?? (Surely not, as each node can have a number of children, show how they are added)
Answer is greatly appreciated if they could be given in drawings.
-
Sonar Systems adminLikes 3
- The following should help http://www.learn-cocos2d.com/files/cocos2d-essential-reference-sample/Influencing_the_Draw_Order.html
- In terms of ordering nodes, if a z index isn’t specified then the node added last is on top
- The above link should help with this answer
This reply has been verified.
-
pabitrapadhyLikes 2
Thank You.
Exactly what I’ve been looking for. :)
-
Sonar Systems adminLikes 1
Great to hear
Login to reply