This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (NSString *)superviewPath:(UIView *)view | |
| { | |
| NSMutableArray *path = [NSMutableArray array]; | |
| while (view != nil) | |
| { | |
| [path insertObject:[NSString stringWithFormat:@"(%p) %@",view,NSStringFromClass([view class])] atIndex:0]; | |
| view = [view superview]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define CGRectSetPos( r, x, y ) CGRectMake( x, y, r.size.width, r.size.height ) | |
| #define CGRectSetX( r, x ) CGRectMake( x, r.origin.y, r.size.width, r.size.height ) | |
| #define CGRectSetY( r, y ) CGRectMake( r.origin.x, y, r.size.width, r.size.height ) | |
| #define CGRectSetSize( r, w, h ) CGRectMake( r.origin.x, r.origin.y, w, h ) | |
| #define CGRectSetWidth( r, w ) CGRectMake( r.origin.x, r.origin.y, w, r.size.height ) | |
| #define CGRectSetHeight( r, h ) CGRectMake( r.origin.x, r.origin.y, r.size.width, h ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)achievementUnlocked:(NSString *)achievement { | |
| [achievements_ addObject:achievement]; | |
| // lazy load the achievements layer | |
| if (!achievementLayer_) { | |
| CGSize winSize = [[CCDirector sharedDirector] winSize]; | |
| // instantiate the layer | |
| achievementLayer_ = [[CCLayer alloc] init]; | |
| achievementLayer_.anchorPoint = ccp(0,0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)updateGamesWon { | |
| gamesWonInARow_++; | |
| if (gamesWonInARow_ && (gamesWonInARow_ % 10 == 0 || gamesWonInARow_ == 5)) { | |
| NSInteger bonus = score_* ((float)gamesWonInARow_ / 100); | |
| score_ += bonus; | |
| NSString *achievement = [NSString stringWithFormat:@"%d games in a row! (+%d)", gamesWonInARow_, bonus]; | |
| [self achievementUnlocked:achievement]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)updateCorrectKeysPressed { | |
| correctKeysPressed_++; | |
| correctKeysPressedThisGame_++; | |
| // update the current score, 10 points for a correct key and 3 points for each consecutive correct key | |
| score_ += 10 + (correctKeysPressedThisGame_ - 1) * 3; | |
| if (correctKeysPressed_ && correctKeysPressed_ % 10 == 0) { | |
| // compute the bonus based on consecutive correct keys | |
| NSInteger bonus = score_ * ((float)correctKeysPressed_/200); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)updateCorrectKeysPressed { | |
| correctKeysPressed_++; | |
| correctKeysPressedThisGame_++; | |
| // update the current score, 10 points for a correct key and 3 points for each consecutive correct key | |
| score_ += 10 + (correctKeysPressedThisGame_ - 1) * 3; | |
| if (correctKeysPressed_ && correctKeysPressed_ % 10 == 0) { | |
| // compute the bonus based on consecutive correct keys | |
| NSInteger bonus = score_ * ((float)correctKeysPressed_/200); |
NewerOlder