June 2014
Beginner to intermediate
434 pages
9h 49m
English
We are going to add more Bird objects to fly around. To do this, we're going to replace our _bird variable with an array and write some code to spawn the birds:
GameScene.m file and remove the _bird variable. Instead, add two new instance variables to the GameScene class, as shown in the following code:@implementation GameScene
{
CCSpriteBatchNode *_batchNode;
Hunter *_hunter;
float _timeUntilNextBird;
NSMutableArray *_birds;
}update: method:-(void)spawnBird { //1 CGSize viewSize = [CCDirector sharedDirector].viewSize; //2 int maxY = viewSize.height * 0.9f; int minY = viewSize.height * 0.6f; int birdY = minY + arc4random_uniform(maxY - minY); int birdX = viewSize.width ...