Vector<SpriteFrame*> frames(7);
SpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("Anim/data.plist");
auto animSpr = Sprite::create("Anim/a1.png");
for (int i = 1; i <= 7; i++) {
auto frame = String::createWithFormat("a%d.png", i);
frames.pushBack(
SpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
frame->getCString()));
}
Animation* anim = Animation::createWithSpriteFrames(frames, 0.05f);
animSpr->setScale(2);
animSpr->setPosition(Point((visibleSize.width + origin.x) / 2, (visibleSize.height + origin.y) * 5 / 100) );
this->addChild(animSpr, 68);
animSpr->runAction(Animate::create(anim));
I tried RemoveSelf and removeFromParentAndCleanup but the initial sprite and the last sprite of animation remains on the screen after animation being played. How to remove them?