我必须从 plist 在屏幕上加载图像,我正在使用以下代码
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("level1.plist");
CCSpriteBatchNode *bgBatch = CCSpriteBatchNode::batchNodeWithFile("level1.png");
this->addChild(bgBatch);
CCSprite *bg = CCSprite::spriteWithSpriteFrameName("jug.png");
bg->setPosition(ccp(30,115));
bgBatch->addChild(bg);
但函数“batchNodeWithFile”和“spriteWithSpriteFrameName”已被弃用。我应该使用哪些功能来代替这些功能?
感谢您的帮助,但我已经尝试过了,但是当我运行它时
感谢您的帮助,但我已经尝试过了,当我运行它时
CCSprite* CCSprite::createWithSpriteFrameName(const char *pszSpriteFrameName)
{
CCSpriteFrame *pFrame = CCSpriteFrameCache::sharedSpriteFrameCache()- >spriteFrameByName(pszSpriteFrameName);
#if COCOS2D_DEBUG > 0
char msg[256] = {0};
sprintf(msg, "Invalid spriteFrameName: %s", pszSpriteFrameName);
CCAssert(pFrame != NULL, msg); /* it stops right here and gives error "Assertion failed: (pFrame != __null), function createWithSpriteFrameName, file /Users/gameview/Desktop/mahwish/mahwish/libs/cocos2dx/sprite_nodes/CCSprite.cpp, line 158."
#endif
我究竟做错了什么?