Book Image

Learning iPhone Game Development with Cocos2D 3.0

By : Kirill Muzykov
Book Image

Learning iPhone Game Development with Cocos2D 3.0

By: Kirill Muzykov

Overview of this book

Table of Contents (19 chapters)
Learning iPhone Game Development with Cocos2D 3.0
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – adding hit points


Okay, let's add a point floating from the bird we hit with an arrow:

  1. The first thing we need to do is to add the fonts to the Xcode project. We're going to add all fonts at once, not only the points font. There are a lot of files, so it would be better to create a group for them. Go ahead and create a subgroup called Fonts in the Resources group.

  2. Add all the font files that we've created to that group. You should have a total of 12 files: two files (.png and .fnt) per font, 2 font variations (Retina and non-Retina), and total of 3 fonts. This gives us 2 * 2 * 3 = 12.

    Note

    If you have the trial version of Glyph Designer or some issues with exporting files, you can just take all the font files from the Chapter_06/Assets/BitmapFont folder in the book's supporting files.

  3. After adding the font files, open the Bird.m file, and add the following method:

    -(void)displayPoints:(int)amount
    {
        //1
        NSString *ptsStr = [NSString stringWithFormat:@"%d", amount];
       ...