diff options
| author | Starla Insigna <starla4444@gmail.com> | 2013-01-04 13:18:54 -0500 |
|---|---|---|
| committer | Starla Insigna <starla4444@gmail.com> | 2013-01-04 13:18:54 -0500 |
| commit | fe7ec5e55f609e628932c65d3f0bfe4948c9d023 (patch) | |
| tree | 4b4f90b9cdc460f6326f2d11ee60d084ef87f337 /Classes | |
| parent | 964cad39cd7373a320516914cbcb0c4207ed4e64 (diff) | |
| download | cartcollect-fe7ec5e55f609e628932c65d3f0bfe4948c9d023.tar.gz cartcollect-fe7ec5e55f609e628932c65d3f0bfe4948c9d023.tar.bz2 cartcollect-fe7ec5e55f609e628932c65d3f0bfe4948c9d023.zip | |
Added stars to selection screen
Closes #231
Diffstat (limited to 'Classes')
| -rw-r--r-- | Classes/GameModeSelection.m | 27 |
1 files changed, 27 insertions, 0 deletions
| diff --git a/Classes/GameModeSelection.m b/Classes/GameModeSelection.m index ea5f45b..3c495df 100644 --- a/Classes/GameModeSelection.m +++ b/Classes/GameModeSelection.m | |||
| @@ -119,6 +119,33 @@ | |||
| 119 | theMenu.position = ccp(-5, 0); | 119 | theMenu.position = ccp(-5, 0); |
| 120 | [self addChild:theMenu]; | 120 | [self addChild:theMenu]; |
| 121 | 121 | ||
| 122 | // Render the stars | ||
| 123 | UIImage* bronzeStar = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"star_1" ofType:@"png"]]; | ||
| 124 | UIImage* silverStar = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"star_2" ofType:@"png"]]; | ||
| 125 | UIImage* goldStar = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"star_3" ofType:@"png"]]; | ||
| 126 | |||
| 127 | UIGraphicsBeginImageContext(CGSizeMake(boxSize.width-12, boxSize.height-12)); | ||
| 128 | if ((gameMode.numOfStars >= 1) && ([gameMode star:0])) | ||
| 129 | { | ||
| 130 | [bronzeStar drawInRect:CGRectMake(8, 0, 32, 32)]; | ||
| 131 | } | ||
| 132 | |||
| 133 | if ((gameMode.numOfStars >= 2) && ([gameMode star:1])) | ||
| 134 | { | ||
| 135 | [silverStar drawInRect:CGRectMake(48, 0, 32, 32)]; | ||
| 136 | } | ||
| 137 | |||
| 138 | if ((gameMode.numOfStars >= 3) && ([gameMode star:2])) | ||
| 139 | { | ||
| 140 | [goldStar drawInRect:CGRectMake(88, 0, 32, 32)]; | ||
| 141 | } | ||
| 142 | |||
| 143 | CGImageRef starsRef = [UIGraphicsGetImageFromCurrentImageContext() CGImage]; | ||
| 144 | UIGraphicsEndImageContext(); | ||
| 145 | CCSprite* starsSprite = [CCSprite spriteWithCGImage:starsRef key:[NSString stringWithFormat:@"gms-%@-star%d", name, gameMode.starsCollected]]; | ||
| 146 | starsSprite.position = ccp(0, 8); | ||
| 147 | [self addChild:starsSprite]; | ||
| 148 | |||
| 122 | // Render the titles | 149 | // Render the titles |
| 123 | UIFont* titleFont = [UIFont fontWithName:@"AmericanTypewriter-Bold" size:18.0f]; | 150 | UIFont* titleFont = [UIFont fontWithName:@"AmericanTypewriter-Bold" size:18.0f]; |
| 124 | CGSize titleSize = [location sizeWithFont:titleFont constrainedToSize:CGSizeMake(128, 0)]; | 151 | CGSize titleSize = [location sizeWithFont:titleFont constrainedToSize:CGSizeMake(128, 0)]; |
