1.1 --- a/Source/CheckersGame.m Fri Jul 18 13:26:59 2008 -0700
1.2 +++ b/Source/CheckersGame.m Thu Jul 31 11:18:13 2008 -0700
1.3 @@ -27,6 +27,9 @@
1.4 #import "GGBUtils.h"
1.5
1.6
1.7 +#define kKingScale 1.4
1.8 +
1.9 +
1.10 @implementation CheckersGame
1.11
1.12
1.13 @@ -63,6 +66,13 @@
1.14 return GetCGImageNamed( playerNum==0 ?@"Green.png" :@"Red.png" );
1.15 }
1.16
1.17 +- (void) _transformPiece: (Piece*)piece
1.18 +{
1.19 + CGFloat scale = piece.tag ?kKingScale :1.0;
1.20 + piece.transform = CATransform3DMakeScale(scale, scale/cos(self.tablePerspectiveAngle), scale);
1.21 + piece.anchorPoint = CGPointMake(0.5, 0.5*cos(self.tablePerspectiveAngle));
1.22 +}
1.23 +
1.24 - (Piece*) pieceForPlayer: (int)playerNum
1.25 {
1.26 Piece *p = [[Piece alloc] init];
1.27 @@ -70,12 +80,22 @@
1.28 p.style = (playerNum ?kPieceStyle2 :kPieceStyle1);
1.29 p.owner = [self.players objectAtIndex: playerNum];
1.30 p.name = playerNum ?@"2" :@"1";
1.31 + [self _transformPiece: p];
1.32 return [p autorelease];
1.33 }
1.34
1.35 +- (void) perspectiveChanged
1.36 +{
1.37 + for( GridCell *cell in _board.cells ) {
1.38 + Piece *piece = (Piece*) cell.bit;
1.39 + if( piece )
1.40 + [self _transformPiece: piece];
1.41 + }
1.42 +}
1.43 +
1.44 - (void) makeKing: (Piece*)piece
1.45 {
1.46 - piece.scale = 1.4;
1.47 + piece.scale = kKingScale;
1.48 piece.tag = YES; // tag property stores the 'king' flag
1.49 piece.name = piece.owner.index ?@"4" :@"3";
1.50 }