首页 > 其他 > 详细

粒子加到骨骼中

时间:2014-03-19 08:05:10      阅读:266      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfoAsync("armature/robot.png", "armature/robot.plist", "armature/robot.xml", this, NULL);
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfoAsync("armature/hero.ExportJson", this, NULL);

void TestParticleDisplay::onEnter()
{
    ArmatureTestLayer::onEnter();
    setTouchEnabled(true);

    animationID = 0;

    armature = cocos2d::extension::CCArmature::create("robot");
    armature->getAnimation()->playWithIndex(0);
    armature->setPosition(VisibleRect::center());
    armature->setScale(0.48f);
    armature->getAnimation()->setSpeedScale(0.5f);
    addChild(armature);


    CCParticleSystem *p1 = CCParticleSystemQuad::create("Particles/SmallSun.plist");
    CCParticleSystem *p2 = CCParticleSystemQuad::create("Particles/SmallSun.plist");

    cocos2d::extension::CCBone *bone  = cocos2d::extension::CCBone::create("p1");
    bone->addDisplay(p1, 0);
    bone->changeDisplayWithIndex(0, true);
    bone->setIgnoreMovementBoneData(true);
    bone->setZOrder(100);
    bone->setScale(1.2f);
    armature->addBone(bone, "bady-a3");

    bone  = cocos2d::extension::CCBone::create("p2");
    bone->addDisplay(p2, 0);
    bone->changeDisplayWithIndex(0, true);
    bone->setIgnoreMovementBoneData(true);
    bone->setZOrder(100);
    bone->setScale(1.2f);
    armature->addBone(bone, "bady-a30");
}

bool TestParticleDisplay::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
    ++animationID;
    animationID = animationID % armature->getAnimation()->getMovementCount();
    armature->getAnimation()->playWithIndex(animationID);
    return false;
}
bubuko.com,布布扣

粒子加到骨骼中,布布扣,bubuko.com

粒子加到骨骼中

原文:http://www.cnblogs.com/newlist/p/3607997.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!