We won't be able to progress much farther without discussing the rules engine. Some of the configuration of the game, including what type of rack we use for the balls, is controlled by the rules. We will be using a separate "rules" class, OPRulesBase
. Let's look at the complete header for this class first:
#import <Foundation/Foundation.h> #import "cocos2d.h" #import "OPDefinitions.h" @interface OPRulesBase : CCNode { RackLayoutType rackStyle; BallID lastBall; BOOL orderedBalls; GameMode gameMode; BOOL replaceBalls; BOOL isBreak; GameMode player1Goal; GameMode player2Goal; BallID nextOrderedBall; // Number of next ball NSInteger currentPlayer; BOOL isTableScratch; } @property (nonatomic, assign) RackLayoutType rackStyle; @property (nonatomic, assign) BallID lastBall; @property (nonatomic, assign) BOOL orderedBalls; @property (nonatomic, assign) GameMode gameMode; @property (nonatomic, assign)...