June 2014
Beginner to intermediate
434 pages
9h 49m
English
Let's go ahead and add the code to keep the current game stats and display them using labels:
Common.GameStats and make it a subclass of NSObject. Save the file.GameStats.h file and add the following properties:@property (nonatomic, assign) int score; @property (nonatomic, assign) int birdsLeft; @property (nonatomic, assign) int lives;
GameStats.m file and add the init method:-(instancetype)init
{
if (self = [super init])
{
self.score = 0;
self.birdsLeft = 0;
self.lives = 0;
}
return self;
}HUDLayer.h file and import the GameStats.h header at the top, like this:#import ...