Saturday, October 1, 2022
HomeGame DevelopmentFor assertion exhibits undefined identifier "vec" - C++

For assertion exhibits undefined identifier “vec” – C++


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 exhibits unrecognized mark:

this->addChild(sprite);

for assertion exhibits undefined identifier “vec”:

	for (int i =10020 ; i <=10021 ; i++) {
		sprintf(identify, "%d.png", i);
		vec.pushBack(frameCache->getSpriteFrameByName(identify));
	}


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments