Tuesday, November 5, 2024
HomeGame DevelopmentIs it doable to carry out a sequence body animation with out...

Is it doable 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<SpriteFrame*>checklist;
	checklist.reserve(2);
	checklist.pushBack(SpriteFrameCache::getInstance()->getSpriteFrameByName("10001.png"));
    checklist.pushBack(SpriteFrameCache::getInstance()->getSpriteFrameByName("10002.png"));
	auto pAnimation = Animation::createWithSpriteFrames(checklist, 0.2f, 1000);
	auto pAnimate = Animate::create(pAnimation);
	pSprite2->runAction(pAnimate);

I noticed somebody on the Web 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<SpriteFrame*>checklist;
	checklist.reserve(2);
	auto pAnimation = Animation::createWithSpriteFrames(checklist, 0.2f, 1000);
	auto pAnimate = Animate::create(pAnimation);
	pSprite2->runAction(pAnimate);

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


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments