首页 > 技术文章 > 添加多个CCArmature

newlist 2014-02-21 10:39 原文

CCArmatureDataManager::sharedArmatureDataManager()->
        addArmatureFileInfo("armature\\Cowboy0.png", "armature\\Cowboy0.plist", "armature\\Cowboy.ExportJson");

    for (int i = 0; i < 5; i++)
    {
        cocos2d::extension::CCArmature *armature = cocos2d::extension::CCArmature::create("Cowboy");
        armature->getAnimation()->playWithIndex(0);
        armature->setPosition(ccp(CCDirector::sharedDirector()->getWinSize().width / 2,
            CCDirector::sharedDirector()->getWinSize().height / 2));
        armature->setScale(0.2f);
        addChild(armature, 0, i);
    }

    getChildByTag(0)->setAnchorPoint(ccp(0, 0));
    getChildByTag(1)->setAnchorPoint(ccp(0, 1));
    getChildByTag(2)->setAnchorPoint(ccp(1, 0));
    getChildByTag(3)->setAnchorPoint(ccp(1, 1));
    getChildByTag(4)->setAnchorPoint(ccp(0.5, 0.5));

 

推荐阅读