Friday, September 23, 2022
HomeGame DevelopmentIs it potential to carry out a sequence body animation with out...

Is it potential to carry out a sequence body animation with out including each body? – C++


I solely know that the sequence body animation needs to be executed like this, the code is as follows:

SpriteFrameCache::getInstance()->addSpriteFramesWithFile("a.plist");
	auto pSprite2 = Sprite::create();
	pSprite2->setPosition(500, 600);
	this->addChild(pSprite2,2);
	Vector<SpriteBody*>record;
	record.reserve(2);
	record.pushBack(SpriteFrameCache::getInstance()->getSpriteFrameByName("10001.png"));
    record.pushBack(SpriteFrameCache::getInstance()->getSpriteFrameByName("10002.png"));
	auto pAnimation = Animation::createWithSpriteFrames(record, 0.2f, 1000);
	auto pAnimate = Animate::create(pAnimation);
	pSprite2->runAction(pAnimate);

I noticed somebody on the Internet saying that it may be executed with out including the next two traces of code, that’s to say, change the code to this? Modified as follows:

SpriteFrameCache::getInstance()->addSpriteFramesWithFile("a.plist");
	auto pSprite2 = Sprite::create();
	pSprite2->setPosition(500, 600);
	this->addChild(pSprite2,2);
	Vector<SpriteBody*>record;
	record.reserve(2);
	auto pAnimation = Animation::createWithSpriteFrames(record, 0.2f, 1000);
	auto pAnimate = Animate::create(pAnimation);
	pSprite2->runAction(pAnimate);

But this doesn’t work. How ought to it’s modified?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments