- 论坛徽章:
- 1
|
5可用积分
各位大神:看一下我的错误在哪里啊,鄙人小菜,忘各位高手提携。
代码如下:
在init里面的代码:
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("2/w.plist");
batchNode = CCSpriteBatchNode::create("2/w.png");
addChild(batchNode);
CCSprite *spr;
spr->CCSprite::createWithSpriteFrameName("2/p_2_01.png");
spr->setPosition(ccp(CCRANDOM_0_1() * 480, CCRANDOM_0_1() * 320));
batchNode->addChild(spr);
首先:
1、我在2这个目录下有w.plist、也有w.png
2、我的文件夹里也有p_2_01.png;
但是还是报错:
报错内容如下:
Assert failed: Invalid spriteFrameName: 2/p_2_01.png
Assertion failed!
Program: ...ts\wangjun88\proj.win32\Debug.win32\libcocos2d.dll
File: d:\cocos2d-x-2.2.3\cocos2dx\sprite_nodes\ccsprite.cpp
Line: 128
Expression: pFrame != 0
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts
(Press Retry to debug the application - JIT must be enabled) |
|