游戏中出场动画的衔接

初次深入学习cocos2dx遇到了很多问题,今天一个任务的入场动画难道了我,最后解决了,现在把问题记录下,以便以后能快速解决问题。
首先入场动画结束以后应该要把入场动画的资源清理掉,不然后续动画上面就会留下上面一个动画的最后一帧。
auto repeat = Repeat::create(startAnimate(node), n);//入场帧动画(就播放N次)
auto call = CallFunc::create(this, callfunc_selector(Hero::callFuncRepeatForver));//在Sequence里面能重复播放
auto callRemoveStart = CallFunc::create(CC_CALLBACK_0(Sprite::removeFromParent, startSprite));//入场动画播放完以后移除入场动画 (startSprite帧动画所在的Sprite)

this->runAction(Sequence::create(repeat,callRemoveStart , call, nullptr));//实现了如此动画结束然后主角出现重复播放的动画

callFuncRepeatForver回调函数
void Hero::callFuncRepeatForver(){
auto animation_ = Animation::createWithSpriteFrames(getAnimationFrameVec(), 0.1f, 1);
animation_->retain();
auto moveAnimate = Animate::create(animation_);
auto moveRepeatForever = RepeatForever::create(moveAnimate);
this->runAction(moveRepeatForever);
}