Convert NSBundle to Cocos2d-iphone to Cocos2d-x

Convert NSBundle to Cocos2d-iphone to Cocos2d-x
0.0 0



I try to follow a tutorial on raywenderlich site, but I have no idea how I can use to substitute NSBundle
Another thing is how I can iterate in the values that has inside the plist file called “TowersPosition”
How i can convert to cocos2d-x the following code: (I use cocos2d-x 2.0.1

    NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"TowersPosition" ofType:@"plist"];
    NSArray * towerPositions = [NSArray arrayWithContentsOfFile:plistPath];
    towerBases = [[NSMutableArray alloc] initWithCapacity:10];

    for(NSDictionary * towerPos in towerPositions)
        CCSprite * towerBase = [CCSprite spriteWithFile:@"open_spot.png"];
        [self addChild:towerBase];
        [towerBase setPosition:ccp([[towerPos objectForKey:@"x"] intValue],[[towerPos objectForKey:@"y"] intValue])];
        [towerBases addObject:towerBase];



See this thread
But that’s about a year ago. By now as I have taken a quick look, you may need to call the following

CCDictionary* CCDictionary::createWithContentsOfFileThreadSafe(const char *pFileName)

It calls


inside, and involves utilizing


class in deepest level. It’s similar to the suggestion in the thread though.


Thanks for the help.