the code as follows:
auto frameCache = SpriteFrameCache::getInstance();
frameCache->addSpriteFramesWithFile("protagonist_move/aaaa.plist");
auto sprite = Sprite::createWithSpriteFrameName("protagonist_move/10020.png");
sprite->setPosition(Vec2(600 , 700));
this->addChild(sprite);
Vector<SpriteFrame*> vec;
char identify[2] = {};
for (int i =10020 ; i <=10021 ; i++) {
sprintf(identify, "%d.png", i);
vec.pushBack(frameCache->getSpriteFrameByName(identify));
}
auto animation = Animation::createWithSpriteFrames(vec, 0.2f, 1000);
animation->setDelayPerUnit(0.05f);
animation->setLoops(-);
animation->setRestoreOriginalFrame(true);
auto animate = Animate::create(animation);
sprite->runAction(animate);
The next line reveals unrecognized mark:
this->addChild(sprite);
for assertion reveals undefined identifier “vec”:
for (int i =10020 ; i <=10021 ; i++) {
sprintf(identify, "%d.png", i);
vec.pushBack(frameCache->getSpriteFrameByName(identify));
}
Strive
std::vector<SpriteFrame*> vec;
Plz Verify additionally your return values.
Perhaps your Sprite pointer is NULL.
I belive you be a newbie, plz learn c++ tutorials additionally.
Thats ist your third entry with probably the most similar points.