Skip to content
Browse files

Added loss screen

  • Loading branch information...
1 parent 8041a1e commit 722ea80a952d48925bc91638cc1f48660bee712a @jakeboxer committed Mar 22, 2011
View
14 SubwaySlide.xcodeproj/project.pbxproj
@@ -9,6 +9,9 @@
/* Begin PBXBuildFile section */
23335ED41339682E00450E90 /* bg_subway-hd.png in Resources */ = {isa = PBXBuildFile; fileRef = 23335ED21339682E00450E90 /* bg_subway-hd.png */; };
23335ED51339682E00450E90 /* bg_subway.png in Resources */ = {isa = PBXBuildFile; fileRef = 23335ED31339682E00450E90 /* bg_subway.png */; };
+ 23335EF01339747200450E90 /* bg_loss-hd.png in Resources */ = {isa = PBXBuildFile; fileRef = 23335EEE1339747200450E90 /* bg_loss-hd.png */; };
+ 23335EF11339747200450E90 /* bg_loss.png in Resources */ = {isa = PBXBuildFile; fileRef = 23335EEF1339747200450E90 /* bg_loss.png */; };
+ 23335EF41339748400450E90 /* LossLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 23335EF31339748400450E90 /* LossLayer.m */; };
23B4512913381ED60096FD8D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23B4512813381ED60096FD8D /* QuartzCore.framework */; };
23B4512B13381ED60096FD8D /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23B4512A13381ED60096FD8D /* OpenGLES.framework */; };
23B4512D13381ED60096FD8D /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23B4512C13381ED60096FD8D /* OpenAL.framework */; };
@@ -129,6 +132,10 @@
/* Begin PBXFileReference section */
23335ED21339682E00450E90 /* bg_subway-hd.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "bg_subway-hd.png"; sourceTree = "<group>"; };
23335ED31339682E00450E90 /* bg_subway.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = bg_subway.png; sourceTree = "<group>"; };
+ 23335EEE1339747200450E90 /* bg_loss-hd.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "bg_loss-hd.png"; sourceTree = "<group>"; };
+ 23335EEF1339747200450E90 /* bg_loss.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = bg_loss.png; sourceTree = "<group>"; };
+ 23335EF21339748400450E90 /* LossLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LossLayer.h; sourceTree = "<group>"; };
+ 23335EF31339748400450E90 /* LossLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LossLayer.m; sourceTree = "<group>"; };
23B4512413381ED60096FD8D /* SubwaySlide.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SubwaySlide.app; sourceTree = BUILT_PRODUCTS_DIR; };
23B4512813381ED60096FD8D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
23B4512A13381ED60096FD8D /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
@@ -384,6 +391,8 @@
23335ED01339681200450E90 /* Backgrounds */ = {
isa = PBXGroup;
children = (
+ 23335EEE1339747200450E90 /* bg_loss-hd.png */,
+ 23335EEF1339747200450E90 /* bg_loss.png */,
23335ED21339682E00450E90 /* bg_subway-hd.png */,
23335ED31339682E00450E90 /* bg_subway.png */,
);
@@ -721,6 +730,8 @@
children = (
23B452911338260B0096FD8D /* GameLayer.h */,
23B452921338260B0096FD8D /* GameLayer.m */,
+ 23335EF21339748400450E90 /* LossLayer.h */,
+ 23335EF31339748400450E90 /* LossLayer.m */,
);
path = Layers;
sourceTree = "<group>";
@@ -822,6 +833,8 @@
23E31E5A133831A400D4C438 /* iTunesArtwork in Resources */,
23335ED41339682E00450E90 /* bg_subway-hd.png in Resources */,
23335ED51339682E00450E90 /* bg_subway.png in Resources */,
+ 23335EF01339747200450E90 /* bg_loss-hd.png in Resources */,
+ 23335EF11339747200450E90 /* bg_loss.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -930,6 +943,7 @@
23B4528113381ED80096FD8D /* AppDelegate.m in Sources */,
23B4528413381ED80096FD8D /* RootViewController.m in Sources */,
23B452931338260B0096FD8D /* GameLayer.m in Sources */,
+ 23335EF41339748400450E90 /* LossLayer.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
2 SubwaySlide/Classes/Layers/GameLayer.h
@@ -1,7 +1,5 @@
#import "cocos2d.h"
-@class Player;
-
@interface GameLayer : CCLayer {
@private
float _accelerometerVelocity;
View
15 SubwaySlide/Classes/Layers/GameLayer.m
@@ -1,4 +1,5 @@
#import "GameLayer.h"
+#import "LossLayer.h"
@interface GameLayer ()
@@ -80,17 +81,11 @@ - (void)considerChangingSubwayVelocity:(ccTime)dt {
- (void)update:(ccTime)dt {
float newRotation = self.rotation - (self.accelerometerVelocity + self.subwayVelocity);
- if (newRotation > 90.0f) {
- newRotation = 90.0f;
- self.accelerometerVelocity = 0;
- self.subwayVelocity = 0;
- } else if (newRotation < -90.0f) {
- newRotation = -90.0f;
- self.accelerometerVelocity = 0;
- self.subwayVelocity = 0;
+ if (fabsf(newRotation) > 90.0f) {
+ [[CCDirector sharedDirector] replaceScene:[LossLayer scene]];
+ } else {
+ self.rotation = newRotation;
}
-
- self.rotation = newRotation;
}
#pragma mark -
View
7 SubwaySlide/Classes/Layers/LossLayer.h
@@ -0,0 +1,7 @@
+#import "cocos2d.h"
+
+@interface LossLayer : CCLayer
+
++ (CCScene*)scene;
+
+@end
View
44 SubwaySlide/Classes/Layers/LossLayer.m
@@ -0,0 +1,44 @@
+#import "GameLayer.h"
+#import "LossLayer.h"
+
+@implementation LossLayer
+
+#pragma mark -
+#pragma mark Creation/Removal Methods
+
++ (CCScene*)scene {
+ CCScene* scene = [CCScene node];
+ [scene addChild:[LossLayer node]];
+
+ return scene;
+}
+
+- (id)init {
+ self = [super init];
+
+ if (nil != self) {
+ CGSize winSize = [[CCDirector sharedDirector] winSize];
+
+ self.isTouchEnabled = YES;
+
+ CCSprite* background = [CCSprite spriteWithFile:@"bg_loss.png"];
+ background.position = ccp(winSize.width * 0.5, winSize.height * 0.5);
+ [self addChild:background z:-1];
+
+ CCLabelTTF* label = [CCLabelTTF labelWithString:@"Play Again"
+ fontName:@"Helvetica"
+ fontSize:30];
+
+ CCMenuItemLabel* menuItem = [CCMenuItemLabel itemWithLabel:label block:^(id sender) {
+ [[CCDirector sharedDirector] replaceScene:[GameLayer scene]];
+ }];
+
+ CCMenu* menu = [CCMenu menuWithItems:menuItem, nil];
+ menu.position = ccp(winSize.width * 0.5, winSize.height * 0.9);
+ [self addChild:menu];
+ }
+
+ return self;
+}
+
+@end
View
BIN SubwaySlide/Resources/Images/Backgrounds/bg_loss-hd.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN SubwaySlide/Resources/Images/Backgrounds/bg_loss.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 722ea80

Please sign in to comment.
Something went wrong with that request. Please try again.