summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStarla Insigna <starla4444@gmail.com>2011-08-24 12:09:32 -0400
committerStarla Insigna <starla4444@gmail.com>2011-08-24 12:09:32 -0400
commit55c94570ae9b7a31167705350dde0a4162058f9b (patch)
tree185b9608bbdc157990aa570e449324ffb33be59d
parentd8f00310e486aed1ab289a0f816acec571193c32 (diff)
parent6b9c8afd0e4a49efffd504378f1db34264928250 (diff)
downloadcartcollect-55c94570ae9b7a31167705350dde0a4162058f9b.tar.gz
cartcollect-55c94570ae9b7a31167705350dde0a4162058f9b.tar.bz2
cartcollect-55c94570ae9b7a31167705350dde0a4162058f9b.zip
Merged in changes from default branch
-rwxr-xr-xCartographic.xcodeproj/project.pbxproj18
-rw-r--r--Classes/JumpGameMode.h21
-rw-r--r--Classes/JumpGameMode.m109
-rw-r--r--Resources/jump.pngbin0 -> 2071 bytes
-rw-r--r--Resources/jump2.pngbin0 -> 2079 bytes
-rw-r--r--Resources/water.pngbin0 -> 981 bytes
6 files changed, 148 insertions, 0 deletions
diff --git a/Cartographic.xcodeproj/project.pbxproj b/Cartographic.xcodeproj/project.pbxproj index 8479e51..58ab09b 100755 --- a/Cartographic.xcodeproj/project.pbxproj +++ b/Cartographic.xcodeproj/project.pbxproj
@@ -117,6 +117,10 @@
117 6C39CFF813FD7638002B21AF /* GameModeSelectionLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C39CFF713FD7637002B21AF /* GameModeSelectionLayer.m */; }; 117 6C39CFF813FD7638002B21AF /* GameModeSelectionLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C39CFF713FD7637002B21AF /* GameModeSelectionLayer.m */; };
118 6C39D00813FD9037002B21AF /* florence.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39D00713FD9037002B21AF /* florence.png */; }; 118 6C39D00813FD9037002B21AF /* florence.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39D00713FD9037002B21AF /* florence.png */; };
119 6C39D01213FD9945002B21AF /* paris.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39D01113FD9945002B21AF /* paris.png */; }; 119 6C39D01213FD9945002B21AF /* paris.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39D01113FD9945002B21AF /* paris.png */; };
120 6C39CFE513FC4635002B21AF /* JumpGameMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C39CFE413FC4635002B21AF /* JumpGameMode.m */; };
121 6C39CFE713FC46CD002B21AF /* water.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFE613FC46CD002B21AF /* water.png */; };
122 6C39CFE913FC8AC4002B21AF /* jump2.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFE813FC8AC4002B21AF /* jump2.png */; };
123 6C39CFEB13FC8ACA002B21AF /* jump.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFEA13FC8ACA002B21AF /* jump.png */; };
120 6C5179C613DF3839006F1F38 /* Morning1.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C5179C513DF3839006F1F38 /* Morning1.png */; }; 124 6C5179C613DF3839006F1F38 /* Morning1.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C5179C513DF3839006F1F38 /* Morning1.png */; };
121 6CC89DD913F2F4E6003704F7 /* Entitlements.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */; }; 125 6CC89DD913F2F4E6003704F7 /* Entitlements.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */; };
122 6CC89DDF13F31413003704F7 /* TutorialMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CC89DDE13F31413003704F7 /* TutorialMode.m */; }; 126 6CC89DDF13F31413003704F7 /* TutorialMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CC89DDE13F31413003704F7 /* TutorialMode.m */; };
@@ -442,6 +446,11 @@
442 6C39CFF713FD7637002B21AF /* GameModeSelectionLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameModeSelectionLayer.m; sourceTree = "<group>"; }; 446 6C39CFF713FD7637002B21AF /* GameModeSelectionLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameModeSelectionLayer.m; sourceTree = "<group>"; };
443 6C39D00713FD9037002B21AF /* florence.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = florence.png; sourceTree = "<group>"; }; 447 6C39D00713FD9037002B21AF /* florence.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = florence.png; sourceTree = "<group>"; };
444 6C39D01113FD9945002B21AF /* paris.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = paris.png; sourceTree = "<group>"; }; 448 6C39D01113FD9945002B21AF /* paris.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = paris.png; sourceTree = "<group>"; };
449 6C39CFE313FC4635002B21AF /* JumpGameMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JumpGameMode.h; sourceTree = "<group>"; };
450 6C39CFE413FC4635002B21AF /* JumpGameMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JumpGameMode.m; sourceTree = "<group>"; };
451 6C39CFE613FC46CD002B21AF /* water.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = water.png; sourceTree = "<group>"; };
452 6C39CFE813FC8AC4002B21AF /* jump2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = jump2.png; sourceTree = "<group>"; };
453 6C39CFEA13FC8ACA002B21AF /* jump.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = jump.png; sourceTree = "<group>"; };
445 6C5179C513DF3839006F1F38 /* Morning1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Morning1.png; sourceTree = "<group>"; }; 454 6C5179C513DF3839006F1F38 /* Morning1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Morning1.png; sourceTree = "<group>"; };
446 6CB532581403BA4F00780A5E /* GameModeSelectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameModeSelectionDelegate.h; sourceTree = "<group>"; }; 455 6CB532581403BA4F00780A5E /* GameModeSelectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameModeSelectionDelegate.h; sourceTree = "<group>"; };
447 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Entitlements.plist; sourceTree = "<group>"; }; 456 6CC89DD813F2F4E6003704F7 /* Entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Entitlements.plist; sourceTree = "<group>"; };
@@ -765,6 +774,7 @@
765 3F6C7F4D13D647B600C038FE /* Sprites */ = { 774 3F6C7F4D13D647B600C038FE /* Sprites */ = {
766 isa = PBXGroup; 775 isa = PBXGroup;
767 children = ( 776 children = (
777 6C39CFE613FC46CD002B21AF /* water.png */,
768 6C29041113EAEC8A0032DA0F /* framestuff.png */, 778 6C29041113EAEC8A0032DA0F /* framestuff.png */,
769 3F6C7EE013D636BE00C038FE /* rock.png */, 779 3F6C7EE013D636BE00C038FE /* rock.png */,
770 3F63FA3E13D4EE53003B3D14 /* oneup.png */, 780 3F63FA3E13D4EE53003B3D14 /* oneup.png */,
@@ -803,6 +813,8 @@
803 children = ( 813 children = (
804 6C19F1641401917900F9CCD3 /* feedback2.png */, 814 6C19F1641401917900F9CCD3 /* feedback2.png */,
805 6C19F1621401917500F9CCD3 /* feedback.png */, 815 6C19F1621401917500F9CCD3 /* feedback.png */,
816 6C39CFEA13FC8ACA002B21AF /* jump.png */,
817 6C39CFE813FC8AC4002B21AF /* jump2.png */,
806 6C39CFE113FC2713002B21AF /* tutorial2.png */, 818 6C39CFE113FC2713002B21AF /* tutorial2.png */,
807 6C39CFDF13FC2708002B21AF /* tutorial.png */, 819 6C39CFDF13FC2708002B21AF /* tutorial.png */,
808 3F7D0F4813D8F17C00B6CE14 /* highscores.png */, 820 3F7D0F4813D8F17C00B6CE14 /* highscores.png */,
@@ -911,6 +923,8 @@
911 3FE79CD313D4DE37001A6B93 /* ClassicGameMode.m */, 923 3FE79CD313D4DE37001A6B93 /* ClassicGameMode.m */,
912 6CC89DDD13F31413003704F7 /* TutorialMode.h */, 924 6CC89DDD13F31413003704F7 /* TutorialMode.h */,
913 6CC89DDE13F31413003704F7 /* TutorialMode.m */, 925 6CC89DDE13F31413003704F7 /* TutorialMode.m */,
926 6C39CFE313FC4635002B21AF /* JumpGameMode.h */,
927 6C39CFE413FC4635002B21AF /* JumpGameMode.m */,
914 ); 928 );
915 name = "Game Modes"; 929 name = "Game Modes";
916 sourceTree = "<group>"; 930 sourceTree = "<group>";
@@ -1437,6 +1451,9 @@
1437 6C39D01213FD9945002B21AF /* paris.png in Resources */, 1451 6C39D01213FD9945002B21AF /* paris.png in Resources */,
1438 6C19F1631401917500F9CCD3 /* feedback.png in Resources */, 1452 6C19F1631401917500F9CCD3 /* feedback.png in Resources */,
1439 6C19F1651401917900F9CCD3 /* feedback2.png in Resources */, 1453 6C19F1651401917900F9CCD3 /* feedback2.png in Resources */,
1454 6C39CFE713FC46CD002B21AF /* water.png in Resources */,
1455 6C39CFE913FC8AC4002B21AF /* jump2.png in Resources */,
1456 6C39CFEB13FC8ACA002B21AF /* jump.png in Resources */,
1440 ); 1457 );
1441 runOnlyForDeploymentPostprocessing = 0; 1458 runOnlyForDeploymentPostprocessing = 0;
1442 }; 1459 };
@@ -1487,6 +1504,7 @@
1487 6C18C3D214033DC50005AA4C /* CocosOverlayScrollView.m in Sources */, 1504 6C18C3D214033DC50005AA4C /* CocosOverlayScrollView.m in Sources */,
1488 6C18C3D314033DC60005AA4C /* NMPanelMenu.m in Sources */, 1505 6C18C3D314033DC60005AA4C /* NMPanelMenu.m in Sources */,
1489 6C18C3D414033DC60005AA4C /* TouchDelegatingView.m in Sources */, 1506 6C18C3D414033DC60005AA4C /* TouchDelegatingView.m in Sources */,
1507 6C39CFE513FC4635002B21AF /* JumpGameMode.m in Sources */,
1490 ); 1508 );
1491 runOnlyForDeploymentPostprocessing = 0; 1509 runOnlyForDeploymentPostprocessing = 0;
1492 }; 1510 };
diff --git a/Classes/JumpGameMode.h b/Classes/JumpGameMode.h new file mode 100644 index 0000000..9753720 --- /dev/null +++ b/Classes/JumpGameMode.h
@@ -0,0 +1,21 @@
1//
2// JumpGameMode.h
3// Cart Collect
4//
5// Created by Starla Insigna on 8/17/11.
6// Copyright 2011 Four Island. All rights reserved.
7//
8
9#import "GameMode.h"
10
11@interface JumpGameMode : GameMode <CCStandardTouchDelegate> {
12 CCSprite* water;
13 int waterTick;
14 BOOL wave;
15 CGPoint gestureStartPoint;
16 int jumpTick;
17 BOOL jump;
18 float expectedAngle;
19}
20
21@end
diff --git a/Classes/JumpGameMode.m b/Classes/JumpGameMode.m new file mode 100644 index 0000000..e30be6a --- /dev/null +++ b/Classes/JumpGameMode.m
@@ -0,0 +1,109 @@
1//
2// JumpGameMode.m
3// Cart Collect
4//
5// Created by Starla Insigna on 8/17/11.
6// Copyright 2011 Four Island. All rights reserved.
7//
8
9#import "JumpGameMode.h"
10
11#define kMinimumGestureLength 50
12
13@implementation JumpGameMode
14
15- (id)init
16{
17 self = [super init];
18
19 if (nil != self)
20 {
21 water = [CCSprite spriteWithFile:@"water.png"];
22 water.position = ccp(240, -80);
23 [self addChild:water];
24
25 self.isTouchEnabled = YES;
26
27 waterTick = 0;
28 wave = NO;
29 }
30
31 return self;
32}
33
34- (void)onEnterTransitionDidFinish
35{
36 [super onEnterTransitionDidFinish];
37
38 [self scheduleDelayedAction:^{
39 wave = YES;
40 } delay:3.0f];
41}
42
43- (void)tick:(ccTime)dt
44{
45 [super tick:dt];
46
47 if (wave)
48 {
49 waterTick++;
50
51 water.position = ccp(240, 160 * sin(waterTick / (36 * M_PI)) - 80);
52
53 if (waterTick == 180)
54 {
55 wave = NO;
56
57 [self scheduleDelayedAction:^{
58 wave = YES;
59 } delay:10.0f];
60 } else if (waterTick == 360)
61 {
62 wave = NO;
63 waterTick = 0;
64 }
65 }
66
67 if (jump)
68 {
69 jumpTick++;
70
71 cart.sprite.position = ccp(cart.sprite.position.x, MAX(100 * sin(jumpTick / (2 * M_PI)) + 22, water.position.y+80+11));
72
73 if (jumpTick == 20)
74 {
75 jump = NO;
76 jumpTick = 0;
77 }
78 } else {
79 cart.sprite.position = ccp(cart.sprite.position.x, MAX(22, water.position.y+80+11));
80 }
81}
82
83- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
84{
85 UITouch* touch = [touches anyObject];
86 gestureStartPoint = [touch locationInView:nil];
87}
88
89- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
90{
91 UITouch* touch = [touches anyObject];
92 CGPoint gestureCurrentPosition = [touch locationInView:nil];
93 CGFloat angle = atan2f(gestureCurrentPosition.y - gestureStartPoint.y, gestureCurrentPosition.x - gestureStartPoint.x);
94 CGFloat distance = sqrt(powf((gestureCurrentPosition.x - gestureStartPoint.x),2) + powf((gestureCurrentPosition.y - gestureStartPoint.y),2));
95
96 if ((distance >= kMinimumGestureLength) && (angle >= expectedAngle - M_PI_4) && (angle <= expectedAngle + M_PI_4) && (cart.sprite.position.y == 22))
97 {
98 jump = YES;
99 }
100}
101
102- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
103{
104 [super accelerometer:accelerometer didAccelerate:acceleration];
105
106 expectedAngle = acceleration.y*M_PI_2;
107}
108
109@end
diff --git a/Resources/jump.png b/Resources/jump.png new file mode 100644 index 0000000..4546088 --- /dev/null +++ b/Resources/jump.png
Binary files differ
diff --git a/Resources/jump2.png b/Resources/jump2.png new file mode 100644 index 0000000..3e83046 --- /dev/null +++ b/Resources/jump2.png
Binary files differ
diff --git a/Resources/water.png b/Resources/water.png new file mode 100644 index 0000000..bf4ff13 --- /dev/null +++ b/Resources/water.png
Binary files differ