Hello I am making a cocos2d side scroller. I need to use a sprite sheet for my game and when I do use it it gives me a SIGABRT error I used an exception breakpoint to see the exact line of code that is causing the problem and got this line:
NSAssert(spriteFrame!=nil, @"Invalid spriteFrame for sprite");
The output is:
2013-08-24 15:51:28.410 App[2171:a0b] sprite sheet name is characterssheet_poses 2013-08-24 15:51:28.419 App[2171:a0b] bruisedImage = (null) 2013-08-24 15:51:28.420 App[2171:a0b] cocos2d: CCSpriteFrameCache: Frame '(null)' not found 2013-08-24 15:51:28.420 App[2171:a0b] bruisedPose = (null) 2013-08-24 15:51:28.421 App[2171:a0b] defaultImage = (null) 2013-08-24 15:51:28.421 App[2171:a0b] cocos2d: CCSpriteFrameCache: Frame '(null)' not found 2013-08-24 15:51:28.422 App[2171:a0b] defaultPose = (null) 2013-08-24 15:51:28.422 App[2171:a0b] *** Assertion failure in -[CCSprite initWithSpriteFrame:],
Here is the code that is causing the problem and that is displaying this output:
NSString* spriteSheetName = [theDictionary objectForKey:@"SpriteSheet"];
CCLOG(@"sprite sheet name is %@", spriteSheetName);
NSString* plistName = [NSString stringWithFormat:@"%@.plist", spriteSheetName ];
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:plistName ];
NSString* bruisedImage = [theDictionary objectForKey:@"BruisedPose"];
CCLOG(@"bruisedImage = %@",bruisedImage);
bruisedPose = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:bruisedImage];
CCLOG(@"bruisedPose = %@",bruisedPose);
NSString* defaultImage = [theDictionary objectForKey:@"BasePose"];
CCLOG(@"defaultImage = %@",defaultImage);
defaultPose = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:defaultImage];
CCLOG(@"defaultPose = %@",defaultPose);
I am using sprite sheets and a .plist file to make my game. The sprite sheet's .plist file looks like this:
The .plist file I am using for game data looks like this: