diff options
Diffstat (limited to 'Classes')
-rw-r--r-- | Classes/GameModeSelection.h | 2 | ||||
-rw-r--r-- | Classes/GameModeSelection.m | 38 | ||||
-rw-r--r-- | Classes/TutorialMode.m | 4 |
3 files changed, 37 insertions, 7 deletions
diff --git a/Classes/GameModeSelection.h b/Classes/GameModeSelection.h index aadbf36..66d0a5a 100644 --- a/Classes/GameModeSelection.h +++ b/Classes/GameModeSelection.h | |||
@@ -16,7 +16,6 @@ | |||
16 | NSString* unlockCondition; | 16 | NSString* unlockCondition; |
17 | 17 | ||
18 | CCLabelBMFont* nameLabel; | 18 | CCLabelBMFont* nameLabel; |
19 | CCSprite* picture; | ||
20 | CCLabelBMFont* otherLabel; | 19 | CCLabelBMFont* otherLabel; |
21 | } | 20 | } |
22 | 21 | ||
@@ -26,5 +25,6 @@ | |||
26 | @property (nonatomic,assign) int highscore; | 25 | @property (nonatomic,assign) int highscore; |
27 | @property (nonatomic,retain) NSString* unlockCondition; | 26 | @property (nonatomic,retain) NSString* unlockCondition; |
28 | - (id)initWithName:(NSString*)name location:(NSString*)location filename:(NSString*)filename unlocked:(BOOL)unlocked; | 27 | - (id)initWithName:(NSString*)name location:(NSString*)location filename:(NSString*)filename unlocked:(BOOL)unlocked; |
28 | - (void)buttonTapped; | ||
29 | 29 | ||
30 | @end | 30 | @end |
diff --git a/Classes/GameModeSelection.m b/Classes/GameModeSelection.m index 56e65d9..0816828 100644 --- a/Classes/GameModeSelection.m +++ b/Classes/GameModeSelection.m | |||
@@ -7,6 +7,8 @@ | |||
7 | // | 7 | // |
8 | 8 | ||
9 | #import "GameModeSelection.h" | 9 | #import "GameModeSelection.h" |
10 | #import "TutorialMode.h" | ||
11 | #import "ClassicGameMode.h" | ||
10 | 12 | ||
11 | @implementation GameModeSelection | 13 | @implementation GameModeSelection |
12 | 14 | ||
@@ -51,11 +53,28 @@ | |||
51 | 53 | ||
52 | UIGraphicsPopContext(); | 54 | UIGraphicsPopContext(); |
53 | CGImageRef innerPictureRef = [UIGraphicsGetImageFromCurrentImageContext() CGImage]; | 55 | CGImageRef innerPictureRef = [UIGraphicsGetImageFromCurrentImageContext() CGImage]; |
54 | UIGraphicsEndImageContext(); | ||
55 | 56 | ||
56 | picture = [CCSprite spriteWithCGImage:innerPictureRef key:filename]; | 57 | if (unlocked) |
57 | picture.position = ccp(0, 32); | 58 | { |
58 | [self addChild:picture]; | 59 | CCSprite* picture = [CCSprite spriteWithCGImage:innerPictureRef key:[NSString stringWithFormat:@"gms-%@", filename]]; |
60 | UIGraphicsPushContext(context); | ||
61 | CGContextSetFillColorWithColor(context, [[UIColor colorWithRed:0 green:0 blue:0 alpha:0.5] CGColor]); | ||
62 | CGContextFillRect(context, CGRectMake(0, 0, 128, 128)); | ||
63 | UIGraphicsPopContext(); | ||
64 | CGImageRef selectedButtonRef = [UIGraphicsGetImageFromCurrentImageContext() CGImage]; | ||
65 | CCSprite* selectedButton = [CCSprite spriteWithCGImage:selectedButtonRef key:[NSString stringWithFormat:@"gms-%@-selected", filename]]; | ||
66 | |||
67 | CCMenuItemSprite* pictureMenuItem = [CCMenuItemSprite itemFromNormalSprite:picture selectedSprite:selectedButton target:self selector:@selector(buttonTapped)]; | ||
68 | CCMenu* theMenu = [CCMenu menuWithItems:pictureMenuItem, nil]; | ||
69 | theMenu.position = ccp(0, 32); | ||
70 | [self addChild:theMenu]; | ||
71 | } else { | ||
72 | CCSprite* picture = [CCSprite spriteWithCGImage:innerPictureRef key:[NSString stringWithFormat:@"gms-%@-locked", filename]]; | ||
73 | picture.position = ccp(0, 32); | ||
74 | [self addChild:picture]; | ||
75 | } | ||
76 | |||
77 | UIGraphicsEndImageContext(); | ||
59 | } | 78 | } |
60 | 79 | ||
61 | return self; | 80 | return self; |
@@ -85,4 +104,15 @@ | |||
85 | } | 104 | } |
86 | } | 105 | } |
87 | 106 | ||
107 | - (void)buttonTapped | ||
108 | { | ||
109 | if ([name isEqual:@"Tutorial"]) | ||
110 | { | ||
111 | [[CCDirector sharedDirector] replaceScene:[TutorialMode scene]]; | ||
112 | } else if ([name isEqual:@"Collect"]) | ||
113 | { | ||
114 | [[CCDirector sharedDirector] replaceScene:[ClassicGameMode scene]]; | ||
115 | } | ||
116 | } | ||
117 | |||
88 | @end | 118 | @end |
diff --git a/Classes/TutorialMode.m b/Classes/TutorialMode.m index c28bd08..1285597 100644 --- a/Classes/TutorialMode.m +++ b/Classes/TutorialMode.m | |||
@@ -12,7 +12,7 @@ | |||
12 | #import "Bottle.h" | 12 | #import "Bottle.h" |
13 | #import "OneUp.h" | 13 | #import "OneUp.h" |
14 | #import "Rock.h" | 14 | #import "Rock.h" |
15 | #import "MainMenuLayer.h" | 15 | #import "GameModeSelectionLayer.h" |
16 | 16 | ||
17 | // Item tags: | 17 | // Item tags: |
18 | // 2000 - first dropped item | 18 | // 2000 - first dropped item |
@@ -227,7 +227,7 @@ | |||
227 | [self schedule:@selector(randomlyAddObject:) interval:1.0f]; | 227 | [self schedule:@selector(randomlyAddObject:) interval:1.0f]; |
228 | } else if ([currentTutorial.name isEqual:@"end"]) | 228 | } else if ([currentTutorial.name isEqual:@"end"]) |
229 | { | 229 | { |
230 | [[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:3.0f scene:[MainMenuLayer scene] withColor:ccc3(0,0,0)]]; | 230 | [[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:3.0f scene:[GameModeSelectionLayer scene] withColor:ccc3(0,0,0)]]; |
231 | } | 231 | } |
232 | 232 | ||
233 | self.currentTutorial = nil; | 233 | self.currentTutorial = nil; |