Game Development Reference
Once you're satisfied with your bitmap font, you can save the entire project so that you
can restore previous settings. To save the font in a format usable by cocos2d, you have
to save it via File Export in the .fnt (Cocos2d Text) format. You can then add the
FNT and PNG files created by Glyph Designer to your Xcode project and use the FNT
file with the CCLabelBMFont class.
Caution If you try to display characters using a CCLabelBMFont , which
aren't available in the .fnt file, they'll simply be skipped and not displayed.
For example, if you do [label setString:@"Hello, World!"] , but
your bitmap font contains only lowercase letters and no punctuation characters,
you'll see the string “ello orld” displayed instead.
Simply Playing Audio
I've added some audio files to complete this game. In the Resources folder of the
DoodleDrop04 project, you'll find the audio files named blues.mp3 and alien-
sfx.caf that you can add to your project. The first choice and the easiest way to play
audio files in cocos2d is by using the SimpleAudioEngine . Audio support is not
an integral part of cocos2d; this is the domain of CocosDenshion, a third-party addition
to cocos2d and fortunately distributed with cocos2d.
Tip If you're looking for an alternative sound engine, I recommend Ob-
jectAL, available from http://kstenerud.github.com/ObjectAL-
jectAL has a cleanly written API and excellent documentation but is only com-
patible with iOS.
Because CocosDenshion is treated as separate code from cocos2d, you have to add the
corresponding header files whenever you use the CocosDenshion audio functionality,