summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStarla Insigna <starla4444@gmail.com>2013-01-02 23:27:26 -0500
committerStarla Insigna <starla4444@gmail.com>2013-01-02 23:27:26 -0500
commitba19dd3f2517a95e09dcfe288a781c6f335b5e81 (patch)
tree681e43be807ed46b75dab6b291a6a6dd3e67b6e5
parent28497668761472e085d0c9955aa8077d11bf353c (diff)
parentf82fdb7134632c1a52902d44c0d555dac0225898 (diff)
downloadcartcollect-ba19dd3f2517a95e09dcfe288a781c6f335b5e81.tar.gz
cartcollect-ba19dd3f2517a95e09dcfe288a781c6f335b5e81.tar.bz2
cartcollect-ba19dd3f2517a95e09dcfe288a781c6f335b5e81.zip
Pulled in trunk changes because the iOS 6 bug was making it impossible to test
-rwxr-xr-xCartographic.xcodeproj/project.pbxproj10
-rw-r--r--Classes/Cart.h2
-rw-r--r--Classes/Cart.m15
-rwxr-xr-xClasses/Cart_CollectAppDelegate.m3
-rw-r--r--Classes/GameMode.h6
-rw-r--r--Classes/GameMode.m69
-rwxr-xr-xClasses/HighscoreListController.m22
-rw-r--r--Classes/JumpGameMode.m46
-rwxr-xr-xResources/Info.plist4
9 files changed, 132 insertions, 45 deletions
diff --git a/Cartographic.xcodeproj/project.pbxproj b/Cartographic.xcodeproj/project.pbxproj index 464cf44..32912ef 100755 --- a/Cartographic.xcodeproj/project.pbxproj +++ b/Cartographic.xcodeproj/project.pbxproj
@@ -104,6 +104,7 @@
104 6C19F1651401917900F9CCD3 /* feedback2.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C19F1641401917900F9CCD3 /* feedback2.png */; }; 104 6C19F1651401917900F9CCD3 /* feedback2.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C19F1641401917900F9CCD3 /* feedback2.png */; };
105 6C29041013EAEB590032DA0F /* TutorialBubble.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C29040F13EAEB590032DA0F /* TutorialBubble.m */; }; 105 6C29041013EAEB590032DA0F /* TutorialBubble.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C29040F13EAEB590032DA0F /* TutorialBubble.m */; };
106 6C29041213EAEC8A0032DA0F /* framestuff.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C29041113EAEC8A0032DA0F /* framestuff.png */; }; 106 6C29041213EAEC8A0032DA0F /* framestuff.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C29041113EAEC8A0032DA0F /* framestuff.png */; };
107 6C2A07781436100C007AB76C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C2A07771436100C007AB76C /* CoreMotion.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
107 6C39CFE013FC2708002B21AF /* tutorial.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFDF13FC2708002B21AF /* tutorial.png */; }; 108 6C39CFE013FC2708002B21AF /* tutorial.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFDF13FC2708002B21AF /* tutorial.png */; };
108 6C39CFE213FC2713002B21AF /* tutorial2.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFE113FC2713002B21AF /* tutorial2.png */; }; 109 6C39CFE213FC2713002B21AF /* tutorial2.png in Resources */ = {isa = PBXBuildFile; fileRef = 6C39CFE113FC2713002B21AF /* tutorial2.png */; };
109 6C39CFE513FC4635002B21AF /* JumpGameMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C39CFE413FC4635002B21AF /* JumpGameMode.m */; }; 110 6C39CFE513FC4635002B21AF /* JumpGameMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C39CFE413FC4635002B21AF /* JumpGameMode.m */; };
@@ -434,6 +435,7 @@
434 6C29040E13EAEB590032DA0F /* TutorialBubble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TutorialBubble.h; sourceTree = "<group>"; }; 435 6C29040E13EAEB590032DA0F /* TutorialBubble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TutorialBubble.h; sourceTree = "<group>"; };
435 6C29040F13EAEB590032DA0F /* TutorialBubble.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TutorialBubble.m; sourceTree = "<group>"; }; 436 6C29040F13EAEB590032DA0F /* TutorialBubble.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TutorialBubble.m; sourceTree = "<group>"; };
436 6C29041113EAEC8A0032DA0F /* framestuff.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = framestuff.png; sourceTree = "<group>"; }; 437 6C29041113EAEC8A0032DA0F /* framestuff.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = framestuff.png; sourceTree = "<group>"; };
438 6C2A07771436100C007AB76C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
437 6C39CFDF13FC2708002B21AF /* tutorial.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tutorial.png; sourceTree = "<group>"; }; 439 6C39CFDF13FC2708002B21AF /* tutorial.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tutorial.png; sourceTree = "<group>"; };
438 6C39CFE113FC2713002B21AF /* tutorial2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tutorial2.png; sourceTree = "<group>"; }; 440 6C39CFE113FC2713002B21AF /* tutorial2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tutorial2.png; sourceTree = "<group>"; };
439 6C39CFE313FC4635002B21AF /* JumpGameMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JumpGameMode.h; sourceTree = "<group>"; }; 441 6C39CFE313FC4635002B21AF /* JumpGameMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JumpGameMode.h; sourceTree = "<group>"; };
@@ -670,6 +672,7 @@
670 isa = PBXFrameworksBuildPhase; 672 isa = PBXFrameworksBuildPhase;
671 buildActionMask = 2147483647; 673 buildActionMask = 2147483647;
672 files = ( 674 files = (
675 6C2A07781436100C007AB76C /* CoreMotion.framework in Frameworks */,
673 DCCBF1B70F6022AE0040855A /* CoreGraphics.framework in Frameworks */, 676 DCCBF1B70F6022AE0040855A /* CoreGraphics.framework in Frameworks */,
674 DCCBF1B90F6022AE0040855A /* Foundation.framework in Frameworks */, 677 DCCBF1B90F6022AE0040855A /* Foundation.framework in Frameworks */,
675 DCCBF1BB0F6022AE0040855A /* OpenGLES.framework in Frameworks */, 678 DCCBF1BB0F6022AE0040855A /* OpenGLES.framework in Frameworks */,
@@ -740,6 +743,7 @@
740 children = ( 743 children = (
741 6C88B69314119B5A0049E402 /* libTestFlight.a */, 744 6C88B69314119B5A0049E402 /* libTestFlight.a */,
742 3F8395D013D746200059AEE8 /* libsqlite3.0.dylib */, 745 3F8395D013D746200059AEE8 /* libsqlite3.0.dylib */,
746 6C2A07771436100C007AB76C /* CoreMotion.framework */,
743 DCCBF1B60F6022AE0040855A /* CoreGraphics.framework */, 747 DCCBF1B60F6022AE0040855A /* CoreGraphics.framework */,
744 DCCBF1B80F6022AE0040855A /* Foundation.framework */, 748 DCCBF1B80F6022AE0040855A /* Foundation.framework */,
745 DCCBF1BA0F6022AE0040855A /* OpenGLES.framework */, 749 DCCBF1BA0F6022AE0040855A /* OpenGLES.framework */,
@@ -1680,6 +1684,7 @@
1680 INFOPLIST_FILE = Resources/Info.plist; 1684 INFOPLIST_FILE = Resources/Info.plist;
1681 INFOPLIST_PREFIX_HEADER = Versioning.h; 1685 INFOPLIST_PREFIX_HEADER = Versioning.h;
1682 INFOPLIST_PREPROCESS = YES; 1686 INFOPLIST_PREPROCESS = YES;
1687 IPHONEOS_DEPLOYMENT_TARGET = 3.0;
1683 LIBRARY_SEARCH_PATHS = ( 1688 LIBRARY_SEARCH_PATHS = (
1684 "$(inherited)", 1689 "$(inherited)",
1685 "\"$(SRCROOT)\"", 1690 "\"$(SRCROOT)\"",
@@ -1689,6 +1694,7 @@
1689 "-ObjC", 1694 "-ObjC",
1690 ); 1695 );
1691 PRODUCT_NAME = Cartographic; 1696 PRODUCT_NAME = Cartographic;
1697 SDKROOT = iphoneos;
1692 TARGETED_DEVICE_FAMILY = 1; 1698 TARGETED_DEVICE_FAMILY = 1;
1693 WARNING_CFLAGS = "-Wall"; 1699 WARNING_CFLAGS = "-Wall";
1694 }; 1700 };
@@ -1712,6 +1718,7 @@
1712 INFOPLIST_FILE = Resources/Info.plist; 1718 INFOPLIST_FILE = Resources/Info.plist;
1713 INFOPLIST_PREFIX_HEADER = Versioning.h; 1719 INFOPLIST_PREFIX_HEADER = Versioning.h;
1714 INFOPLIST_PREPROCESS = YES; 1720 INFOPLIST_PREPROCESS = YES;
1721 IPHONEOS_DEPLOYMENT_TARGET = 3.0;
1715 LIBRARY_SEARCH_PATHS = ( 1722 LIBRARY_SEARCH_PATHS = (
1716 "$(inherited)", 1723 "$(inherited)",
1717 "\"$(SRCROOT)\"", 1724 "\"$(SRCROOT)\"",
@@ -1721,6 +1728,7 @@
1721 "-ObjC", 1728 "-ObjC",
1722 ); 1729 );
1723 PRODUCT_NAME = Cartographic; 1730 PRODUCT_NAME = Cartographic;
1731 SDKROOT = iphoneos;
1724 TARGETED_DEVICE_FAMILY = 1; 1732 TARGETED_DEVICE_FAMILY = 1;
1725 WARNING_CFLAGS = "-Wall"; 1733 WARNING_CFLAGS = "-Wall";
1726 }; 1734 };
@@ -1815,6 +1823,7 @@
1815 INFOPLIST_FILE = Resources/Info.plist; 1823 INFOPLIST_FILE = Resources/Info.plist;
1816 INFOPLIST_PREFIX_HEADER = Versioning.h; 1824 INFOPLIST_PREFIX_HEADER = Versioning.h;
1817 INFOPLIST_PREPROCESS = YES; 1825 INFOPLIST_PREPROCESS = YES;
1826 IPHONEOS_DEPLOYMENT_TARGET = 3.0;
1818 LIBRARY_SEARCH_PATHS = ( 1827 LIBRARY_SEARCH_PATHS = (
1819 "$(inherited)", 1828 "$(inherited)",
1820 "\"$(SRCROOT)\"", 1829 "\"$(SRCROOT)\"",
@@ -1824,6 +1833,7 @@
1824 "-ObjC", 1833 "-ObjC",
1825 ); 1834 );
1826 PRODUCT_NAME = Cartographic; 1835 PRODUCT_NAME = Cartographic;
1836 SDKROOT = iphoneos;
1827 TARGETED_DEVICE_FAMILY = 1; 1837 TARGETED_DEVICE_FAMILY = 1;
1828 WARNING_CFLAGS = "-Wall"; 1838 WARNING_CFLAGS = "-Wall";
1829 }; 1839 };
diff --git a/Classes/Cart.h b/Classes/Cart.h index 1058025..af463f2 100644 --- a/Classes/Cart.h +++ b/Classes/Cart.h
@@ -26,6 +26,6 @@
26@property (assign) BOOL boundedByScreen; 26@property (assign) BOOL boundedByScreen;
27- (id)initWithSprite:(CCSprite*)sprite; 27- (id)initWithSprite:(CCSprite*)sprite;
28- (void)tick; 28- (void)tick;
29- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration; 29- (void)deviceDidRotate:(double)pitch;
30 30
31@end 31@end
diff --git a/Classes/Cart.m b/Classes/Cart.m index 0344bdf..f9da181 100644 --- a/Classes/Cart.m +++ b/Classes/Cart.m
@@ -54,7 +54,7 @@
54 if ((delegate != nil) && ([delegate respondsToSelector:@selector(cartShouldFall:)])) 54 if ((delegate != nil) && ([delegate respondsToSelector:@selector(cartShouldFall:)]))
55 { 55 {
56 int bottom = [delegate cartShouldFall:self]; 56 int bottom = [delegate cartShouldFall:self];
57 sprite.position = ccp(sprite.position.x, MAX(bottom, sprite.position.y-6)); 57 sprite.position = ccp(sprite.position.x, MAX(bottom, sprite.position.y-8));
58 } else { 58 } else {
59 NSLog(@"Falling is set on a cart without a compatible game mode."); 59 NSLog(@"Falling is set on a cart without a compatible game mode.");
60 } 60 }
@@ -62,15 +62,14 @@
62 } 62 }
63} 63}
64 64
65- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration 65#define kFilterFactor 0.05f
66
67- (void)deviceDidRotate:(double)pitch
66{ 68{
67 static float prevY=0; 69 static float prevY=0;
68 70 float accelY = -((float) pitch * kFilterFactor + (1- kFilterFactor)*prevY);
69#define kFilterFactor 0.05f 71
70 72 prevY = accelY;
71 float accelY = -((float) acceleration.y * kFilterFactor + (1- kFilterFactor)*prevY);
72
73 prevY = accelY;
74 accelX = accelY * 750; 73 accelX = accelY * 750;
75} 74}
76 75
diff --git a/Classes/Cart_CollectAppDelegate.m b/Classes/Cart_CollectAppDelegate.m index 25a2aa4..c92d231 100755 --- a/Classes/Cart_CollectAppDelegate.m +++ b/Classes/Cart_CollectAppDelegate.m
@@ -114,7 +114,8 @@
114 [viewController setView:glView]; 114 [viewController setView:glView];
115 115
116 // make the View Controller a child of the main window 116 // make the View Controller a child of the main window
117 [window addSubview: viewController.view]; 117 [window setRootViewController:viewController];
118 //[window addSubview: viewController.view];
118 119
119 [window makeKeyAndVisible]; 120 [window makeKeyAndVisible];
120 121
diff --git a/Classes/GameMode.h b/Classes/GameMode.h index cd41884..e208d49 100644 --- a/Classes/GameMode.h +++ b/Classes/GameMode.h
@@ -10,6 +10,7 @@
10#import "Cart.h" 10#import "Cart.h"
11#import "FallingObjectFactory.h" 11#import "FallingObjectFactory.h"
12#import "GameModeInfo.h" 12#import "GameModeInfo.h"
13#import <CoreMotion/CoreMotion.h>
13 14
14#define GAME_SCENE 436 15#define GAME_SCENE 436
15#define GAME_LAYER 437 16#define GAME_LAYER 437
@@ -31,6 +32,10 @@
31 void (^delayedAction)(void); 32 void (^delayedAction)(void);
32 33
33 BOOL isPaused; 34 BOOL isPaused;
35
36 BOOL hasGyroscope;
37 double pitch;
38 CMMotionManager* motionManager;
34} 39}
35 40
36@property (readonly) Cart* cart; 41@property (readonly) Cart* cart;
@@ -46,5 +51,6 @@
46- (void)scheduleDelayedAction:(void(^)(void))delayedAction delay:(float)delay; 51- (void)scheduleDelayedAction:(void(^)(void))delayedAction delay:(float)delay;
47- (void)runDelayedAction; 52- (void)runDelayedAction;
48+ (GameModeInfo*)info; 53+ (GameModeInfo*)info;
54- (void)setPitch:(double)m_pitch;
49 55
50@end 56@end
diff --git a/Classes/GameMode.m b/Classes/GameMode.m index 3e2f3ee..49d0053 100644 --- a/Classes/GameMode.m +++ b/Classes/GameMode.m
@@ -20,8 +20,6 @@
20 20
21 if (nil != self) 21 if (nil != self)
22 { 22 {
23 isAccelerometerEnabled_ = YES;
24
25 objects = [[NSMutableSet alloc] init]; 23 objects = [[NSMutableSet alloc] init];
26 24
27 cart = [[Cart alloc] initWithSprite:[CCSprite spriteWithFile:@"cart.png"]]; 25 cart = [[Cart alloc] initWithSprite:[CCSprite spriteWithFile:@"cart.png"]];
@@ -53,6 +51,26 @@
53 } 51 }
54 52
55 isPaused = NO; 53 isPaused = NO;
54
55 Class cmClass = (NSClassFromString(@"CMMotionManager"));
56 if (cmClass)
57 {
58 motionManager = [[CMMotionManager alloc] init];
59
60 if (motionManager.gyroAvailable)
61 {
62 [motionManager setDeviceMotionUpdateInterval:1.0f/60.0f];
63 isAccelerometerEnabled_ = NO;
64 hasGyroscope = YES;
65 } else {
66 isAccelerometerEnabled_ = YES;
67 motionManager = nil;
68 hasGyroscope = NO;
69 }
70 } else {
71 isAccelerometerEnabled_ = YES;
72 hasGyroscope = NO;
73 }
56 } 74 }
57 75
58 return self; 76 return self;
@@ -60,19 +78,39 @@
60 78
61- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration 79- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration
62{ 80{
63 [cart accelerometer:accelerometer didAccelerate:acceleration]; 81 self.pitch = acceleration.y;
64} 82}
65 83
66- (void)onEnterTransitionDidFinish 84- (void)onEnterTransitionDidFinish
67{ 85{
68 [super onEnterTransitionDidFinish]; 86 [super onEnterTransitionDidFinish];
69 87
70 [[UIAccelerometer sharedAccelerometer] setUpdateInterval:(1.0 / 60)]; 88 if (hasGyroscope)
89 {
90 [motionManager startDeviceMotionUpdates];
91 } else {
92 [[UIAccelerometer sharedAccelerometer] setUpdateInterval:(1.0 / 60)];
93 }
94
71 [self schedule:@selector(tick:) interval:1.0f/60.0f]; 95 [self schedule:@selector(tick:) interval:1.0f/60.0f];
72} 96}
73 97
98- (void)onExit
99{
100 if (hasGyroscope)
101 {
102 [motionManager stopDeviceMotionUpdates];
103 }
104}
105
74- (void)tick:(ccTime)dt 106- (void)tick:(ccTime)dt
75{ 107{
108 if (hasGyroscope)
109 {
110 CMDeviceMotion* motion = [motionManager deviceMotion];
111 self.pitch = -motion.attitude.pitch;
112 }
113
76 [cart tick]; 114 [cart tick];
77 115
78 NSMutableSet* discardedObjects = [NSMutableSet set]; 116 NSMutableSet* discardedObjects = [NSMutableSet set];
@@ -100,6 +138,11 @@
100 138
101 [self pauseSchedulerAndActions]; 139 [self pauseSchedulerAndActions];
102 140
141 if (hasGyroscope)
142 {
143 [motionManager stopDeviceMotionUpdates];
144 }
145
103 shadedLayer = [CCLayerColor layerWithColor:ccc4(0, 0, 0, 127)]; 146 shadedLayer = [CCLayerColor layerWithColor:ccc4(0, 0, 0, 127)];
104 [[[CCDirector sharedDirector] runningScene] addChild:shadedLayer]; 147 [[[CCDirector sharedDirector] runningScene] addChild:shadedLayer];
105 148
@@ -132,6 +175,11 @@
132 shadedLayer = nil; 175 shadedLayer = nil;
133 pauseLayer = nil; 176 pauseLayer = nil;
134 177
178 if (hasGyroscope)
179 {
180 [motionManager startDeviceMotionUpdates];
181 }
182
135 [self resumeSchedulerAndActions]; 183 [self resumeSchedulerAndActions];
136 184
137 isPaused = NO; 185 isPaused = NO;
@@ -202,9 +250,16 @@
202 250
203+ (GameModeInfo*)info 251+ (GameModeInfo*)info
204{ 252{
205 [NSException raise:@"Unimplemented method" format:@"Method -info of GameMode subclasses must be overridden"]; 253 [NSException raise:@"Unimplemented method" format:@"Method -info of GameMode subclasses must be overridden"];
206 254
207 return nil; 255 return nil;
256}
257
258- (void)setPitch:(double)m_pitch
259{
260 pitch = m_pitch;
261
262 [cart deviceDidRotate:pitch];
208} 263}
209 264
210- (void)dealloc 265- (void)dealloc
diff --git a/Classes/HighscoreListController.m b/Classes/HighscoreListController.m index 7370da5..c746421 100755 --- a/Classes/HighscoreListController.m +++ b/Classes/HighscoreListController.m
@@ -24,7 +24,7 @@
24 if (self) { 24 if (self) {
25 localHighscores = [[Highscore localHighscoreListForGameMode:@"Collect"] retain]; 25 localHighscores = [[Highscore localHighscoreListForGameMode:@"Collect"] retain];
26 26
27 navigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)]; 27 navigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 480, 44)];
28 myNavigationItem = [[UINavigationItem alloc] initWithTitle:@"Highscores"]; 28 myNavigationItem = [[UINavigationItem alloc] initWithTitle:@"Highscores"];
29 UIBarButtonItem* barButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(back)]; 29 UIBarButtonItem* barButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(back)];
30 myNavigationItem.leftBarButtonItem = barButton; 30 myNavigationItem.leftBarButtonItem = barButton;
@@ -45,7 +45,7 @@
45 [modeControl addTarget:self action:@selector(switchGameMode:) forControlEvents:UIControlEventValueChanged]; 45 [modeControl addTarget:self action:@selector(switchGameMode:) forControlEvents:UIControlEventValueChanged];
46 UIBarButtonItem* barButton3 = [[UIBarButtonItem alloc] initWithCustomView:modeControl]; 46 UIBarButtonItem* barButton3 = [[UIBarButtonItem alloc] initWithCustomView:modeControl];
47 47
48 toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 480-44, 320, 44)]; 48 toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 320-44, 480, 44)];
49 [toolbar setItems:[NSArray arrayWithObjects:barButton3, btnSpace, barButton2, nil] animated:NO]; 49 [toolbar setItems:[NSArray arrayWithObjects:barButton3, btnSpace, barButton2, nil] animated:NO];
50 [barButton2 release]; 50 [barButton2 release];
51 [btnSpace release]; 51 [btnSpace release];
@@ -55,8 +55,8 @@
55 loadingGlobal = NO; 55 loadingGlobal = NO;
56 56
57 tableView = [(UITableView*)self.view retain]; 57 tableView = [(UITableView*)self.view retain];
58 UIView* parentView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; 58 UIView* parentView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 480, 320)];
59 [tableView setFrame:CGRectMake(0, 44, 320, 480-44-44)]; 59 [tableView setFrame:CGRectMake(0, 44, 480, 320-44-44)];
60 [parentView addSubview:navigationBar]; 60 [parentView addSubview:navigationBar];
61 [parentView addSubview:tableView]; 61 [parentView addSubview:tableView];
62 [parentView addSubview:toolbar]; 62 [parentView addSubview:toolbar];
@@ -101,9 +101,9 @@
101*/ 101*/
102/* 102/*
103// Override to allow orientations other than the default portrait orientation. 103// Override to allow orientations other than the default portrait orientation.
104- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 104- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
105 // Return YES for supported orientations. 105{
106 return YES; 106 return ( interfaceOrientation == UIInterfaceOrientationLandscapeRight );
107} 107}
108*/ 108*/
109 109
@@ -183,7 +183,7 @@
183 UILabel* scoreLabel = [[UILabel alloc] init]; 183 UILabel* scoreLabel = [[UILabel alloc] init];
184 scoreLabel.text = [NSString stringWithFormat:@"%d", highscore.score]; 184 scoreLabel.text = [NSString stringWithFormat:@"%d", highscore.score];
185 CGSize labelSize = [scoreLabel.text sizeWithFont:scoreLabel.font constrainedToSize:CGSizeMake(160, 44) lineBreakMode:UILineBreakModeClip]; 185 CGSize labelSize = [scoreLabel.text sizeWithFont:scoreLabel.font constrainedToSize:CGSizeMake(160, 44) lineBreakMode:UILineBreakModeClip];
186 scoreLabel.frame = CGRectMake(320-10-labelSize.width, 22-labelSize.height/2, labelSize.width, labelSize.height); 186 scoreLabel.frame = CGRectMake(480-10-labelSize.width, 22-labelSize.height/2, labelSize.width, labelSize.height);
187 [cell addSubview:scoreLabel]; 187 [cell addSubview:scoreLabel];
188 [scoreLabel release]; 188 [scoreLabel release];
189 189
@@ -293,10 +293,10 @@
293 { 293 {
294 loadingGlobal = YES; 294 loadingGlobal = YES;
295 295
296 loadingView = [[UIView alloc] initWithFrame:CGRectMake(0, 44, 320, 480-44-44)]; 296 loadingView = [[UIView alloc] initWithFrame:CGRectMake(0, 44, 480, 320-44-44)];
297 activity = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(150, 228-44, 20, 20)]; 297 activity = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(230, 148-44, 20, 20)];
298 activity.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; 298 activity.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
299 statusText = [[UILabel alloc] initWithFrame:CGRectMake(0, 256-44, 320, 21)]; 299 statusText = [[UILabel alloc] initWithFrame:CGRectMake(80, 150, 320, 21)];
300 statusText.text = @"Downloading highscores..."; 300 statusText.text = @"Downloading highscores...";
301 statusText.textAlignment = UITextAlignmentCenter; 301 statusText.textAlignment = UITextAlignmentCenter;
302 302
diff --git a/Classes/JumpGameMode.m b/Classes/JumpGameMode.m index 3788c97..f3e690c 100644 --- a/Classes/JumpGameMode.m +++ b/Classes/JumpGameMode.m
@@ -25,7 +25,19 @@
25 25
26@end 26@end
27 27
28// FallingObject flag 0 is whether the object is floating in water 28@implementation FallingObject (Flags)
29
30- (BOOL)fellDuringWave
31{
32 return flags[0];
33}
34
35- (void)setFellDuringWave:(BOOL)value
36{
37 flags[0] = value;
38}
39
40@end
29 41
30@implementation JumpGameMode 42@implementation JumpGameMode
31 43
@@ -141,10 +153,12 @@ static GameModeInfo* info;
141 } 153 }
142 } 154 }
143 155
156 [ledges minusSet:discardedSet];
157
144 NSMutableSet* discardedObjects = [NSMutableSet set]; 158 NSMutableSet* discardedObjects = [NSMutableSet set];
145 for (FallingObject* object in objects) 159 for (FallingObject* object in objects)
146 { 160 {
147 if ((object.sprite.position.y < 86) && (![object flag:0])) 161 if (object.sprite.position.y < (64+object.sprite.boundingBox.size.height/2))
148 { 162 {
149 for (CCSprite* ledge in ledges) 163 for (CCSprite* ledge in ledges)
150 { 164 {
@@ -167,20 +181,14 @@ static GameModeInfo* info;
167 } 181 }
168 } 182 }
169 183
170 if ((waterTick >= 180) || ((waterTick > 0) && ([object flag:0]))) 184 if (object.fellDuringWave)
171 { 185 {
172 object.sprite.position = ccp(object.sprite.position.x, MAX(object.sprite.position.y, water.position.y+80+11)); 186 object.sprite.position = ccp(object.sprite.position.x, MAX(object.sprite.position.y, water.position.y+80+11));
173 } else { 187 } else {
174 object.sprite.position = ccp(object.sprite.position.x-ledgeScrollSpeed, object.sprite.position.y); 188 object.sprite.position = ccp(object.sprite.position.x-ledgeScrollSpeed, object.sprite.position.y);
175 } 189 }
176
177 if ((waterTick > 0) && (object.sprite.position.y <= (water.position.y+80+11)))
178 {
179 [object setFlag:0 withValue:YES];
180 }
181 } 190 }
182 191
183 [ledges minusSet:discardedSet];
184 [objects minusSet:discardedObjects]; 192 [objects minusSet:discardedObjects];
185 193
186 if (rightmost <= 480) 194 if (rightmost <= 480)
@@ -205,6 +213,9 @@ static GameModeInfo* info;
205 if ((cart.sprite.position.y < 86) && (cart.boundedByScreen)) 213 if ((cart.sprite.position.y < 86) && (cart.boundedByScreen))
206 { 214 {
207 cart.boundedByScreen = NO; 215 cart.boundedByScreen = NO;
216 } else if ((cart.sprite.position.y >= 86) && (!cart.boundedByScreen))
217 {
218 cart.boundedByScreen = YES;
208 } 219 }
209 220
210 if (cart.sprite.position.y == (0-cart.sprite.boundingBox.size.height/2)) 221 if (cart.sprite.position.y == (0-cart.sprite.boundingBox.size.height/2))
@@ -300,13 +311,6 @@ static GameModeInfo* info;
300 isGesturing = NO; 311 isGesturing = NO;
301} 312}
302 313
303- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
304{
305 [super accelerometer:accelerometer didAccelerate:acceleration];
306
307 expectedAngle = acceleration.y*M_PI_2;
308}
309
310- (int)cartShouldFall:(Cart *)m_cart 314- (int)cartShouldFall:(Cart *)m_cart
311{ 315{
312 int bottom = 0-m_cart.sprite.boundingBox.size.height/2; 316 int bottom = 0-m_cart.sprite.boundingBox.size.height/2;
@@ -416,6 +420,7 @@ static GameModeInfo* info;
416 object.delegate = self; 420 object.delegate = self;
417 object.sprite.position = ccp(objectX, 360); 421 object.sprite.position = ccp(objectX, 360);
418 object.sprite.scale = 1; 422 object.sprite.scale = 1;
423 object.fellDuringWave = waterTick > 0;
419 [self addChild:object.sprite]; 424 [self addChild:object.sprite];
420 425
421 [objects addObject:object]; 426 [objects addObject:object];
@@ -450,6 +455,7 @@ static GameModeInfo* info;
450 object.delegate = self; 455 object.delegate = self;
451 object.sprite.position = ccp(objectX, 360); 456 object.sprite.position = ccp(objectX, 360);
452 object.sprite.scale = 1; 457 object.sprite.scale = 1;
458 object.fellDuringWave = waterTick > 0;
453 [self addChild:object.sprite]; 459 [self addChild:object.sprite];
454 460
455 [objects addObject:object]; 461 [objects addObject:object];
@@ -486,6 +492,7 @@ static GameModeInfo* info;
486 object.delegate = self; 492 object.delegate = self;
487 object.sprite.position = ccp(objectX, 360); 493 object.sprite.position = ccp(objectX, 360);
488 object.sprite.scale = 1; 494 object.sprite.scale = 1;
495 object.fellDuringWave = waterTick > 0;
489 [self addChild:object.sprite]; 496 [self addChild:object.sprite];
490 497
491 [objects addObject:object]; 498 [objects addObject:object];
@@ -528,6 +535,13 @@ static GameModeInfo* info;
528 } 535 }
529} 536}
530 537
538- (void)setPitch:(double)m_pitch
539{
540 [super setPitch:m_pitch];
541
542 expectedAngle = pitch*M_PI_2;
543}
544
531@end 545@end
532 546
533@implementation LedgeFactory 547@implementation LedgeFactory
diff --git a/Resources/Info.plist b/Resources/Info.plist index 4a70f3c..de7139a 100755 --- a/Resources/Info.plist +++ b/Resources/Info.plist
@@ -46,7 +46,9 @@
46 <key>UIStatusBarHidden</key> 46 <key>UIStatusBarHidden</key>
47 <true/> 47 <true/>
48 <key>UISupportedInterfaceOrientations</key> 48 <key>UISupportedInterfaceOrientations</key>
49 <array/> 49 <array>
50 <string>UIInterfaceOrientationLandscapeRight</string>
51 </array>
50 <key>UTExportedTypeDeclarations</key> 52 <key>UTExportedTypeDeclarations</key>
51 <array/> 53 <array/>
52 <key>UTImportedTypeDeclarations</key> 54 <key>UTImportedTypeDeclarations</key>