6. Text, Fonts, and the Written Word
In the last two chapters, you learned how to add artificial intelligence, animations, and enemies to your game. In this chapter you get to have a reprieve from the complexities of game mechanics and focus on the text rendering available in Cocos2D. Cocos2D has extensive support for all of the built-in iOS fonts as well as embedded TrueType fonts. The text system allows you to add labels and text to your game with ease.
The font-rendering system in Cocos2D is split into two portions or classes: the
CCLabelTTF and the
CCLabelBMFont classes. This chapter covers both classes and how to use them in Space Viking.
CCLabelTTF class is meant as a quick and easy way to get text into your game with a minimal ...