O'Reilly logo

Cocos2d for iPhone 1 Game Development Cookbook by Nathan Burba

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reading PLIST data files

This recipe, along with the other two that follow, shows us how to read and parse simple data into Cocos2d scenes. Here we read a PLIST file to create a scene that depicts a desert with a few cacti.

Reading PLIST data files

Getting ready

Please refer to the project RecipeCollection01 for full working code of this recipe.

How to do it...

Execute the following code:

#import <Foundation/Foundation.h> /* This returns the full absolute path to a specified file in the bundle */ NSString* getActualPath( NSString* file ) { NSArray* path = [file componentsSeparatedByString: @"."]; NSString* actualPath = [[NSBundle mainBundle] pathForResource: [path objectAtIndex: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required