diff options
author | Starla Insigna <starla4444@gmail.com> | 2011-09-05 12:24:04 -0400 |
---|---|---|
committer | Starla Insigna <starla4444@gmail.com> | 2011-09-05 12:24:04 -0400 |
commit | ef9cab24b9ee3e25ab00d932fbab2f2a91476950 (patch) | |
tree | 64181097c4ba8f5e2fd7ad5efcebac37adff83c5 | |
parent | c505b38ac0ad593ee7c4e56895a06a69878a88d3 (diff) | |
download | cartcollect-ef9cab24b9ee3e25ab00d932fbab2f2a91476950.tar.gz cartcollect-ef9cab24b9ee3e25ab00d932fbab2f2a91476950.tar.bz2 cartcollect-ef9cab24b9ee3e25ab00d932fbab2f2a91476950.zip |
Added zoom/fade transition to selection screen
Refs #207
-rwxr-xr-x | Cartographic.xcodeproj/project.pbxproj | 6 | ||||
-rw-r--r-- | Classes/GameModeSelectionLayer.m | 12 | ||||
-rw-r--r-- | Classes/ZoomFadeTransition.h | 19 | ||||
-rw-r--r-- | Classes/ZoomFadeTransition.m | 60 |
4 files changed, 94 insertions, 3 deletions
diff --git a/Cartographic.xcodeproj/project.pbxproj b/Cartographic.xcodeproj/project.pbxproj index 719aa26..8fd0d47 100755 --- a/Cartographic.xcodeproj/project.pbxproj +++ b/Cartographic.xcodeproj/project.pbxproj | |||
@@ -120,6 +120,7 @@ | |||
120 | 6C39CFF813FD7638002B21AF /* GameModeSelectionLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C39CFF713FD7637002B21AF /* GameModeSelectionLayer.m */; }; | 120 | 6C39CFF813FD7638002B21AF /* GameModeSelectionLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C39CFF713FD7637002B21AF /* GameModeSelectionLayer.m */; }; |
121 | 6C39D00813FD9037002B21AF /* florence.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39D00713FD9037002B21AF /* florence.png */; }; | 121 | 6C39D00813FD9037002B21AF /* florence.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39D00713FD9037002B21AF /* florence.png */; }; |
122 | 6C39D01213FD9945002B21AF /* paris.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39D01113FD9945002B21AF /* paris.png */; }; | 122 | 6C39D01213FD9945002B21AF /* paris.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39D01113FD9945002B21AF /* paris.png */; }; |
123 | 6C4400041415080800A9E1D7 /* ZoomFadeTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C4400031415080700A9E1D7 /* ZoomFadeTransition.m */; }; | ||
123 | 6C44FFFD1413D03300A9E1D7 /* libTestFlight.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C88B69314119B5A0049E402 /* libTestFlight.a */; }; | 124 | 6C44FFFD1413D03300A9E1D7 /* libTestFlight.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C88B69314119B5A0049E402 /* libTestFlight.a */; }; |
124 | 6C5179C613DF3839006F1F38 /* Morning1.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C5179C513DF3839006F1F38 /* Morning1.png */; }; | 125 | 6C5179C613DF3839006F1F38 /* Morning1.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C5179C513DF3839006F1F38 /* Morning1.png */; }; |
125 | 6C85834014055A44009EF100 /* CCNotifications.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C85833F14055A44009EF100 /* CCNotifications.m */; }; | 126 | 6C85834014055A44009EF100 /* CCNotifications.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C85833F14055A44009EF100 /* CCNotifications.m */; }; |
@@ -454,6 +455,8 @@ | |||
454 | 6C39CFF713FD7637002B21AF /* GameModeSelectionLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameModeSelectionLayer.m; sourceTree = "<group>"; }; | 455 | 6C39CFF713FD7637002B21AF /* GameModeSelectionLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameModeSelectionLayer.m; sourceTree = "<group>"; }; |
455 | 6C39D00713FD9037002B21AF /* florence.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = florence.png; sourceTree = "<group>"; }; | 456 | 6C39D00713FD9037002B21AF /* florence.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = florence.png; sourceTree = "<group>"; }; |
456 | 6C39D01113FD9945002B21AF /* paris.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = paris.png; sourceTree = "<group>"; }; | 457 | 6C39D01113FD9945002B21AF /* paris.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = paris.png; sourceTree = "<group>"; }; |
458 | 6C4400021415080700A9E1D7 /* ZoomFadeTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZoomFadeTransition.h; sourceTree = "<group>"; }; | ||
459 | 6C4400031415080700A9E1D7 /* ZoomFadeTransition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZoomFadeTransition.m; sourceTree = "<group>"; }; | ||
457 | 6C5179C513DF3839006F1F38 /* Morning1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Morning1.png; sourceTree = "<group>"; }; | 460 | 6C5179C513DF3839006F1F38 /* Morning1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Morning1.png; sourceTree = "<group>"; }; |
458 | 6C85833E14055A44009EF100 /* CCNotifications.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCNotifications.h; sourceTree = "<group>"; }; | 461 | 6C85833E14055A44009EF100 /* CCNotifications.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCNotifications.h; sourceTree = "<group>"; }; |
459 | 6C85833F14055A44009EF100 /* CCNotifications.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCNotifications.m; sourceTree = "<group>"; }; | 462 | 6C85833F14055A44009EF100 /* CCNotifications.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCNotifications.m; sourceTree = "<group>"; }; |
@@ -990,6 +993,8 @@ | |||
990 | 6C18C3D014033DC40005AA4C /* TouchDelegatingView.h */, | 993 | 6C18C3D014033DC40005AA4C /* TouchDelegatingView.h */, |
991 | 6C18C3D114033DC40005AA4C /* TouchDelegatingView.m */, | 994 | 6C18C3D114033DC40005AA4C /* TouchDelegatingView.m */, |
992 | 6CB532581403BA4F00780A5E /* GameModeSelectionDelegate.h */, | 995 | 6CB532581403BA4F00780A5E /* GameModeSelectionDelegate.h */, |
996 | 6C4400021415080700A9E1D7 /* ZoomFadeTransition.h */, | ||
997 | 6C4400031415080700A9E1D7 /* ZoomFadeTransition.m */, | ||
993 | ); | 998 | ); |
994 | name = "Selection Screen"; | 999 | name = "Selection Screen"; |
995 | sourceTree = "<group>"; | 1000 | sourceTree = "<group>"; |
@@ -1527,6 +1532,7 @@ | |||
1527 | 6C39CFE513FC4635002B21AF /* JumpGameMode.m in Sources */, | 1532 | 6C39CFE513FC4635002B21AF /* JumpGameMode.m in Sources */, |
1528 | 6C85834014055A44009EF100 /* CCNotifications.m in Sources */, | 1533 | 6C85834014055A44009EF100 /* CCNotifications.m in Sources */, |
1529 | 6C85834414055B2E009EF100 /* notificationDesign.m in Sources */, | 1534 | 6C85834414055B2E009EF100 /* notificationDesign.m in Sources */, |
1535 | 6C4400041415080800A9E1D7 /* ZoomFadeTransition.m in Sources */, | ||
1530 | ); | 1536 | ); |
1531 | runOnlyForDeploymentPostprocessing = 0; | 1537 | runOnlyForDeploymentPostprocessing = 0; |
1532 | }; | 1538 | }; |
diff --git a/Classes/GameModeSelectionLayer.m b/Classes/GameModeSelectionLayer.m index ef1d922..17b9d33 100644 --- a/Classes/GameModeSelectionLayer.m +++ b/Classes/GameModeSelectionLayer.m | |||
@@ -15,6 +15,7 @@ | |||
15 | #import "ClassicGameMode.h" | 15 | #import "ClassicGameMode.h" |
16 | #import "NMPanelMenu.h" | 16 | #import "NMPanelMenu.h" |
17 | #import "JumpGameMode.h" | 17 | #import "JumpGameMode.h" |
18 | #import "ZoomFadeTransition.h" | ||
18 | 19 | ||
19 | @implementation GameModeSelectionLayer | 20 | @implementation GameModeSelectionLayer |
20 | 21 | ||
@@ -132,15 +133,20 @@ | |||
132 | 133 | ||
133 | - (void)didSelectGameMode:(GameModeSelection *)gameMode | 134 | - (void)didSelectGameMode:(GameModeSelection *)gameMode |
134 | { | 135 | { |
136 | [pageControl removeFromSuperview]; | ||
137 | |||
138 | CGPoint opp = [scrollView convertPoint:gameMode.position toView:[[CCDirector sharedDirector] openGLView]]; | ||
139 | CGPoint endPosition = ccp(0-(opp.x+158), opp.y); | ||
140 | |||
135 | if ([gameMode.name isEqual:@"Tutorial"]) | 141 | if ([gameMode.name isEqual:@"Tutorial"]) |
136 | { | 142 | { |
137 | [[CCDirector sharedDirector] replaceScene:[TutorialMode scene]]; | 143 | [[CCDirector sharedDirector] replaceScene:[ZoomFadeTransition transitionWithDuration:5.0f scene:[TutorialMode scene] position:endPosition]]; |
138 | } else if ([gameMode.name isEqual:@"Collect"]) | 144 | } else if ([gameMode.name isEqual:@"Collect"]) |
139 | { | 145 | { |
140 | [[CCDirector sharedDirector] replaceScene:[ClassicGameMode scene]]; | 146 | [[CCDirector sharedDirector] replaceScene:[ZoomFadeTransition transitionWithDuration:5.0f scene:[ClassicGameMode scene] position:endPosition]]; |
141 | } else if ([gameMode.name isEqual:@"Jump"]) | 147 | } else if ([gameMode.name isEqual:@"Jump"]) |
142 | { | 148 | { |
143 | [[CCDirector sharedDirector] replaceScene:[JumpGameMode scene]]; | 149 | [[CCDirector sharedDirector] replaceScene:[ZoomFadeTransition transitionWithDuration:5.0f scene:[JumpGameMode scene] position:endPosition]]; |
144 | } | 150 | } |
145 | } | 151 | } |
146 | 152 | ||
diff --git a/Classes/ZoomFadeTransition.h b/Classes/ZoomFadeTransition.h new file mode 100644 index 0000000..856974f --- /dev/null +++ b/Classes/ZoomFadeTransition.h | |||
@@ -0,0 +1,19 @@ | |||
1 | // | ||
2 | // ZoomFadeTransition.h | ||
3 | // Cartographic | ||
4 | // | ||
5 | // Created by Starla Insigna on 9/5/11. | ||
6 | // Copyright (c) 2011 Four Island. All rights reserved. | ||
7 | // | ||
8 | |||
9 | #import "cocos2d.h" | ||
10 | |||
11 | @interface ZoomFadeTransition : CCTransitionScene { | ||
12 | CGPoint endPosition_; | ||
13 | float endScale_; | ||
14 | } | ||
15 | |||
16 | + (id)transitionWithDuration:(ccTime)t scene:(CCScene *)s position:(CGPoint)position; | ||
17 | - (id)initWithDuration:(ccTime)t scene:(CCScene *)s position:(CGPoint)position; | ||
18 | |||
19 | @end | ||
diff --git a/Classes/ZoomFadeTransition.m b/Classes/ZoomFadeTransition.m new file mode 100644 index 0000000..da995ea --- /dev/null +++ b/Classes/ZoomFadeTransition.m | |||
@@ -0,0 +1,60 @@ | |||
1 | // | ||
2 | // ZoomFadeTransition.m | ||
3 | // Cartographic | ||
4 | // | ||
5 | // Created by Starla Insigna on 9/5/11. | ||
6 | // Copyright (c) 2011 Four Island. All rights reserved. | ||
7 | // | ||
8 | |||
9 | #import "ZoomFadeTransition.h" | ||
10 | |||
11 | @implementation ZoomFadeTransition | ||
12 | |||
13 | + (id)transitionWithDuration:(ccTime)t scene:(CCScene *)s position:(CGPoint)position | ||
14 | { | ||
15 | return [[[self alloc] initWithDuration:t scene:s position:position] autorelease]; | ||
16 | } | ||
17 | |||
18 | - (id)initWithDuration:(ccTime)t scene:(CCScene *)s position:(CGPoint)p | ||
19 | { | ||
20 | self = [super initWithDuration:t scene:s]; | ||
21 | |||
22 | if (nil != self) | ||
23 | { | ||
24 | endPosition_ = ccpMult(p, 5.0f); | ||
25 | endScale_ = 5.0f; | ||
26 | } | ||
27 | |||
28 | return self; | ||
29 | } | ||
30 | |||
31 | -(void) onEnter | ||
32 | { | ||
33 | [super onEnter]; | ||
34 | |||
35 | [inScene_ setAnchorPoint:ccp(0.5f, 0.5f)]; | ||
36 | [outScene_ setAnchorPoint:ccp(0.5f, 0.5f)]; | ||
37 | |||
38 | CCLayerColor *l = [CCLayerColor layerWithColor:ccc4(0, 0, 0, 0)]; | ||
39 | [inScene_ setVisible: NO]; | ||
40 | [self addChild: l z:2 tag:0xFADEFADE]; | ||
41 | CCNode *f = [self getChildByTag:0xFADEFADE]; | ||
42 | |||
43 | [f runAction:[CCSequence actions: | ||
44 | [CCDelayTime actionWithDuration:duration_/5], | ||
45 | [CCFadeIn actionWithDuration:duration_/3], | ||
46 | [CCDelayTime actionWithDuration:duration_/5], | ||
47 | [CCFadeOut actionWithDuration:duration_/3], | ||
48 | [CCCallFunc actionWithTarget:self selector:@selector(finish)], | ||
49 | nil]]; | ||
50 | [outScene_ runAction:[CCSpawn actions: | ||
51 | [CCMoveTo actionWithDuration:duration_/3 position:endPosition_], | ||
52 | [CCScaleTo actionWithDuration:duration_/3 scale:endScale_], | ||
53 | nil]]; | ||
54 | [inScene_ runAction: [CCSequence actions: | ||
55 | [CCDelayTime actionWithDuration:duration_/5*3], | ||
56 | [CCCallFunc actionWithTarget:self selector:@selector(hideOutShowIn)], | ||
57 | nil]]; | ||
58 | } | ||
59 | |||
60 | @end | ||