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 title[2] = {};
	for (int i =10020 ; i <=10021 ; i++) {
		sprintf(title, "%d.png", i);
		vec.pushBack(frameCache->getSpriteFrameByName(title));
	}
	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(title, "%d.png", i);
		vec.pushBack(frameCache->getSpriteFrameByName(title));
	}

Try
std::vector<SpriteBody*> vec;

Plz Check additionally your return values.
Maybe 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 identical points.

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here