COCOS2DX obtains all objects of the object subnode, cocos2dx Node

Source: Internet
Author: User

COCOS2DX obtains all objects of the object subnode, cocos2dx Node

3. X:

Const auto & arrayNode = node-> getChildren ();
Int I = 0;
For (auto & child: arrayNode)
{
Node * pNode = dynamic_cast (Child );
If (pNode)
{
PNode-> setZOrder (++ I );
}
}

2. X

CCObject * temp;

CCArray * nodeArray = rootNode-> getChildren ();

CCARRAY_FOREACH (nodeArray, temp)

{

Temp-> setZOrder (++ I );

}

LUA

 

 

local function seach_child(parente)        local childCount = parente:getChildrenCount()        if childCount < 1 then            node_list[parente:getName()] = parente        else             for i = 1, childCount do                dump(parente)                node_list[parente:getName()] = parente                seach_child(parente:getChildren()[i])            end        end    end for k , v in next ,children do     if #v:getChildren() < 1 then        node_list[v:getName()] = v        else        seach_child(v)    endendreturn node_list

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.