Home Game Development Got a bug with body animation? – C++

Got a bug with body animation? – C++

0
Got a bug with body animation? – C++

[ad_1]

I’m certain there isn’t any error within the location of the plist file and png picture, why is that this error nonetheless displaying?
the code as follows:

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

the errors as follows:
11

please take away “/” from “”/protagonist_move/a.plist” => ““protagonist_move/a.plist”

The downside nonetheless exists after modification

I uploaded the demo file, please check out what’s the downside.
demo.zip (1.2 MB)

The appropriate sprite body title is “10020.png” and “10021.png”, you possibly can test it in aaaa.plist, additionally you don’t want 10020.png and 10021.png, the aaaa.plist will add aaaa.png.

If 10020.png and 10021.png aren’t wanted, how ought to the code be written?

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here