June 2014
Beginner to intermediate
434 pages
9h 49m
English
In most games, we can win or lose. This makes the game interesting. In our game, we will win the game if we avoid losing. To be more specific, we will lose if we allow some number of the birds to fly away, for example, 3 birds out of 20. If we'll hit more than 17 birds, then we'll win.
Let's add the code to win and lose the game:
GameScene.h file and add enum with game states and a property to hold the current state, as shown in the following code:#import "CCScene.h" typedef enum GameState { GameStateUninitialized, GameStatePlaying, GameStatePaused, GameStateWon, GameStateLost } GameState; @interface GameScene : CCScene @property (nonatomic, assign) GameState gameState; @end