Home Game Development For assertion exhibits undefined identifier “vec” – C++

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

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

[ad_1]

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<SpriteBody*> 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 following 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));
	}

Try
std::vector<SpriteBody*> vec;

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here