CCSprite* mySprite = CCSprite::create("mysprite.png"); //create a new sprite this->addChild(mySprite); //add the sprite as a child to the current node
CCNode* myNode = CCNode::create(); //create a new node this->addChild(myNode, 2, "myNode"); //add the node as a child, with z-order 2 and a tag of "myNode"In this example, we create a new CCNode called "myNode" and then add it as a child to the current node using the addChild function. We also specify a z-order of 2 and a tag of "myNode". Package Library: cocos2d-x