Time for action – adding birds
In this game, the hunter will hunt birds, so let's create a bird object by performing the following steps:
- Open Xcode and create a new subgroup in the
Resources
group, next to theHunter
and theBackgrounds
groups. Call this new groupBirds
. - Open the
Chapter_04/Assets/Birds
folder and drag all images into the newBirds
group in Xcode. Make sure that copy option is checked. - Create a new Objective-C class in the
GameObjects
group. Name this classBird
and make it a subclass ofCCSprite
. - Open the
Bird.h
file and replace its contents with the following code:#import "CCSprite.h" typedef enum BirdType { BirdTypeBig, BirdTypeMedium, BirdTypeSmall } BirdType; @interface Bird : CCSprite @property (nonatomic, assign) BirdType ...
Get Learning iPhone Game Development with Cocos2D 3.0 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.