I am currently doing this Cocos2d tutorial: http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d
...and get the following error messages:
2011-12-30 16:36:28.536 AnimBear[11273:10a03] cocos2d: CCTexture2D. Can't create Texture. UIImage is nil
2011-12-30 16:36:28.537 AnimBear[11273:10a03] cocos2d: Couldn't add image:AnimBear_default.png.ccz in CCTextureCache
2011-12-30 16:36:28.537 AnimBear[11273:10a03] cocos2d: CCSpriteFrameCache: couldn't load texture file. File not found: AnimBear_default.png.ccz
2011-12-30 16:36:28.538 AnimBear[11273:10a03] cocos2d: CCTexture2D. Can't create Texture. UIImage is nil
2011-12-30 16:36:28.538 AnimBear[11273:10a03] cocos2d: Couldn't add image:AnimBear_default.png.ccz in CCTextureCache
2011-12-30 16:36:28.539 AnimBear[11273:10a03] cocos2d: CCSpriteFrameCache: couldn't load texture file. File not found: AnimBear_default.png.ccz
2011-12-30 16:36:28.540 AnimBear[11273:10a03] cocos2d: CCTexture2D. Can't create Texture. UIImage is nil
2011-12-30 16:36:28.540 AnimBear[11273:10a03] cocos2d: Couldn't add image:AnimBear_default.png.ccz in CCTextureCache
2011-12-30 16:36:28.541 AnimBear[11273:10a03] cocos2d: CCSpriteFrameCa[Switching to process 11273 thread 0x1410b]
[Switching to process 11273 thread 0x10a03]
che: Frame 'bear1.png' not found
2011-12-30 16:36:28.598 AnimBear[11273:10a03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x17e4052 0x1975d0a 0x17d136e 0x17d2220 0xc1997 0x3fcf1 0xc16dd 0xc0d7c 0x828b0e 0x8298a6 0x838743 0x8391f8 0x82caa9 0x2798fa9 0x17b81c5 0x171d022 0x171b90a 0x171adb4 0x171accb 0x8292a7 0x82aa9b 0xc085f 0x2135)
terminate called throwing an exceptionsharedlibrary apply-load-rules all
I have the following files in the Resource folder:
- AnimBear_default.png.ccz
- AnimBear_default.plist
The texture consists of eight(8) bears named Bear1.png - Bear8.png. I have bought and done the texture in Zwoptex, latest version.
The code looks like:
-(id) init {
if((self = [super init])) {
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"AnimBear_default.plist" textureFile:@"AnimBear_default.png.ccz"];
CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"AnimBear_default.png.ccz"];
[self addChild:spriteSheet];
NSMutableArray *walkAnimFrames = [NSMutableArray array];
for (int i = 1; i <= 8 ; ++i) {
[walkAnimFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"bear%d.png", i]]];
}
CCAnimation *walkAnim = [CCAnimation animationWithFrames:walkAnimFrames delay:0.1f];
CGSize winSize = [CCDirector sharedDirector].winSize;
self.bear = [CCSprite spriteWithSpriteFrameName:@"bear1.png"];
_bear.position = ccp(winSize.width/2, winSize.height/2);
self.walkAction = [CCRepeatForever actionWithAction:
[CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO]];
[_bear runAction:_walkAction];
[spriteSheet addChild:_bear];
}
return self;
}
I am completely new to Cocos2d and have been trying to search the web and tried different things but with no success :-(