title: Cocos2dx - play frame animation forever, but pause for a few second before the repeat
body: <p>I am trying to play a frame animation sequence looping forever, but after each play, I'd like to delay for a period of time before the next loop.</p>
  
  <p>Here's the specific code:</p>
  
  <pre><code>    CCActionInterval *pAnimate = CCAnimate::create( m_pAnimationDebugSkill );
      CCDelayTime *pDelayTime = CCDelayTime::create( 3.0f );
      CCRepeatForever *pRepeat = CCRepeatForever::create( CCSequence::createWithTwoActions(pAnimate, pDelayTime) );
      m_pSpriteDebugSkillAnimation-&gt;runAction( pRepeat );
  </code></pre>
  
  <p>I am expecting pAnimate to play, then pDelayTime to hold for 3 seconds, then pAnimate to play again...
  But what happens is pAnimate is playing and repeating forever... pDelayTime has no effect at all...</p>
  
  <p>Anyone has any idea?</p>
  
  <p>Here's the complete code:</p>
  
  <pre><code>        // Skill button animation
      m_pSpriteDebugSkillAnimation = CCSprite::createWithSpriteFrame(
          CCSpriteFrameCache::sharedSpriteFrameCache()-&gt;spriteFrameByName(s_szNameSpriteFrame[UI_BOARD_RUNES_ANIM_BTN_SKILL_0])
      );
      m_pSpriteDebugSkillAnimation-&gt;setAnchorPoint(ccp(0.5f, 0.5f));
      INT iNumFrames = UI_BOARD_RUNES_ANIM_BTN_SKILL_END - UI_BOARD_RUNES_ANIM_BTN_SKILL_START + 1;
      CCArray *pAnimSkill = CCArray::create();
      for ( INT i = 0; i &lt; iNumFrames; i++ ) {
          CCSpriteFrame *pFrame = CCSpriteFrameCache::sharedSpriteFrameCache()-&gt;spriteFrameByName(s_szNameSpriteFrame[UI_BOARD_RUNES_ANIM_BTN_SKILL_0+i]);
          pAnimSkill-&gt;addObject(pFrame);
      }
      m_pAnimationDebugSkill = CCAnimation::createWithSpriteFrames( pAnimSkill, DEFAULT_TIME_ANIM );
      m_pAnimationDebugSkill-&gt;setLoops( -1 );
      m_pAnimationDebugSkill-&gt;retain();
      CCActionInterval *pAnimate = CCAnimate::create( m_pAnimationDebugSkill );
      CCDelayTime *pDelayTime = CCDelayTime::create( 3.0f );
      CCRepeatForever *pRepeat = CCRepeatForever::create( CCSequence::createWithTwoActions(pAnimate, pDelayTime) );
      m_pSpriteDebugSkillAnimation-&gt;runAction( pRepeat );
  
      CCSprite *pSpriteSkill = CCSprite::createWithSpriteFrame(
          CCSpriteFrameCache::sharedSpriteFrameCache()-&gt;spriteFrameByName(s_szNameSpriteFrame[UI_BOARD_RUNES_BTN_SKILL])
      );
      FLOAT fSpriteSkillWidth = pSpriteSkill-&gt;boundingBox().size.width;
      FLOAT fSpriteSkillHeight = pSpriteSkill-&gt;boundingBox().size.height;
      m_pSpriteDebugSkillAnimation-&gt;setPosition(ccp(fSpriteSkillWidth/2.0f, fSpriteSkillHeight/2.0f));
      pSpriteSkill-&gt;addChild( m_pSpriteDebugSkillAnimation );
      //pSpriteSkill-&gt;setAnchorPoint(ccp(0.5f, 0.5f));
      //pSpriteSkill-&gt;setPosition(ccp(fScreenHalfWidth, 1100.0f));
      //this-&gt;addChild(pSpriteSkill);
      m_pBtnDebugSkill = CCMenuItemSprite::create( pSpriteSkill, pSpriteSkill, pSpriteSkill, this, menu_selector(CGameScreen::onTouchSkillButton) );
      m_pBtnDebugSkill-&gt;setPosition(ccp(fScreenHalfWidth, 1100.0f));
      m_pMenuRoot-&gt;addChild( m_pBtnDebugSkill );
  </code></pre>