cocos3 帧动画无限重复

    auto animation = Animation::create(); 
    animation->addSpriteFrameWithFile("NPC/hero.png");
    animation->addSpriteFrameWithFile("NPC/hero1.png");
  
    // should last 2.8 seconds. And there are 14 frames. 
    animation->setDelayPerUnit(2.8f / 14.0f); 
    animation->setRestoreOriginalFrame(true); 
    auto action = Animate::create(animation);
    auto repeat=RepeatForever::create(action);
    auto creep=RepeatForever::create(action);
    runAction(creep); 

 

posted @ 2014-12-28 09:03  yufenghou  阅读(400)  评论(0编辑  收藏  举报