【问题标题】:Animating a sprite with frames cocos2dx 3.2使用帧 cocos2dx 3.2 动画精灵
【发布时间】:2014-08-31 17:27:08
【问题描述】:

我的动画不工作。它向我展示了我在初始化目标精灵时提到的帧。谁能告诉我,我到底错过了什么?谢谢。

SpriteFrameCache *spriteCache = SpriteFrameCache::getInstance();
spriteCache->addSpriteFramesWithFile("explode.plist", "explosion_rollv2.png");

Vector<SpriteFrame*> frames(22);
for (int i; i<= 22; i++)
{
        CCString *frame_name = CCString::createWithFormat("%d.png",i);
        auto frame = spriteCache->getSpriteFrameByName(frame_name->getCString());
        //frames->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(frame->getCString()));
        frames.pushBack(frame);

}

    auto blast_frame = Animation::createWithSpriteFrames(frames,0.1);
    blast_frame->setRestoreOriginalFrame(true);
    auto blast = Sprite::createWithSpriteFrameName("0.png");
    blast->setPosition(Vec2(visibleSize.width/2,visibleSize.height/2));
    this->addChild(blast,500);

    blast->runAction(RepeatForever::create(Animate::create(blast_frame)));

【问题讨论】:

    标签: c++ cocos2d-x cocos2d-x-3.0


    【解决方案1】:

    对于所有遇到此问题的人,这是一个链接http://www.cocos2d-x.org/wiki/Sprite_Sheet_Animation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-06
      • 2011-12-01
      • 2013-01-17
      相关资源
      最近更新 更多