Using plist files with cocos2d-x

Using plist files with cocos2d-x
0.0 0



I try to follow this tutorial from Raywenderlich sites

But I don’t know how I can use this part of the tutorial

- (CCAnimation *)animationFromPlist:(NSString *)animPlist delay:(float)delay {

    NSString *plistPath = [[NSBundle mainBundle] pathForResource:animPlist ofType:@"plist"]; // 1
    NSArray *animImages = [NSArray arrayWithContentsOfFile:plistPath]; // 2
    NSMutableArray *animFrames = [NSMutableArray array]; // 3
    for(NSString *animImage in animImages) { // 4
        [animFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:animImage]]; // 5
    return [CCAnimation animationWithFrames:animFrames delay:delay]; // 6


This part get a text in the plist files, any help will be appreciated.


you have several examples about loading animations in the tests project, sprites folder


Thanks, I didn’t know these tests exists in this folder.