Game Development Reference
In-Depth Information
Note
A
bundle
, which is sometimes called a
package
, is just a folder structure
that OS X and iOS treat like a single file. Every app is a bundle, and you can
peek inside its contents in OS X if you right-click an .app file and select
Show
Package Contents
.
You can see and browse the bundle files in Xcode: just locate the
Resources
group, and
you'll see a
Published-iOS
folder with a blue icon. That folder and all of its contents will
be added to the compiled app bundle as is. However, you shouldn't manually add files to
that folder or edit them because the
Published-iOS
and
Published-Android
folders are
managed by SpriteBuilder, meaning your changes may be lost when publishing the
SpriteBuilder project.
This loop is repeated until the first
Level#.ccb
file returns a path string that is
nil
, indic-
ating that the file couldn't be found. Because the level file that wasn't found was already
counted, the
count
variable is reduced by one just after the loop before returning the
value.
In order to use the
levelCount
method, edit the
setHighestUnlockedLevel:
method and replace the first line with the one highlighted in
Listing 8-21
.
Listing 8-21
.
Assigning the levelCount result
-(void) setHighestUnlockedLevel:(int)level
{
int totalLevelCount = [self levelCount];
if (_currentLevel > 0 && _currentLevel <=
totalLevelCount)
{
[[NSUserDefaults standardUserDefaults]
setInteger:level
forKey:KeyForUnlockedLevel];
}
}
Showing the Correct Level-Selection Page
Search WWH ::
Custom Search