0
嗨,我是新來的cocos2dx v3,我覺得它有非常乾淨的API,但非常差的文檔。我正在嘗試從http://particle2dx.com/加載一些粒子動畫。從那裏我得到一個.plist文件如何打開它並加載動畫。就一個.plist文件中的精靈圖片動畫而言,我知道要做到這一點,但在那種情況下,我事先知道幀名稱和編號。但如何從.plist文件播放粒子動畫。cocos2dx v3粒子動畫
這裏是我做從的.plist文件播放我怎麼可以修改它
auto cache = SpriteFrameCache::getInstance();
cache->addSpriteFramesWithFile("run.plist");
Vector<SpriteFrame*> frames = Vector<SpriteFrame*>();
frames.pushBack(cache->getSpriteFrameByName("0001.png"));
frames.pushBack(cache->getSpriteFrameByName("0002.png"));
frames.pushBack(cache->getSpriteFrameByName("0003.png"));
frames.pushBack(cache->getSpriteFrameByName("0004.png"));
frames.pushBack(cache->getSpriteFrameByName("0005.png"));
frames.pushBack(cache->getSpriteFrameByName("0006.png"));
Animation* anim = cocos2d::Animation::createWithSpriteFrames(frames, 0.1f, 1);
Animate* anim_action = cocos2d::Animate::create(anim);
auto sprite = Sprite::create("boy1.png");
//sprite is already added to scene elsewhere and ready to go
sprite->runAction(RepeatForever::create(anim_action));
sprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
this->addChild(sprite, 2);