summary refs log tree commit diff stats
path: root/Classes/PauseLayer.m
diff options
context:
space:
mode:
Diffstat (limited to 'Classes/PauseLayer.m')
-rwxr-xr-xClasses/PauseLayer.m68
1 files changed, 68 insertions, 0 deletions
diff --git a/Classes/PauseLayer.m b/Classes/PauseLayer.m new file mode 100755 index 0000000..53574b2 --- /dev/null +++ b/Classes/PauseLayer.m
@@ -0,0 +1,68 @@
1//
2// PauseLayer.m
3// Cart Collect
4//
5// Created by iD Student Account on 7/20/11.
6// Copyright 2011 __MyCompanyName__. All rights reserved.
7//
8
9#import "PauseLayer.h"
10
11@implementation PauseLayer
12
13+ (CCScene*)sceneWithScene:(CCScene*)scene2
14{
15 CCScene* scene = [CCScene node];
16
17 CCLayerColor* backgroundLayer = [CCLayerColor layerWithColor:ccc4(255, 255, 255, 255)];
18 CCSprite* backgroundImage = [CCSprite spriteWithFile:@"SeaBeach.png"];
19 backgroundImage.position = ccp(240,160);
20 [backgroundLayer addChild:backgroundImage];
21 [scene addChild:backgroundLayer];
22
23 CCLayerColor* backgroundLayer2 = [CCLayerColor layerWithColor:ccc4(0, 0, 0, 127)];
24 [scene addChild:backgroundLayer2];
25
26 PauseLayer* layer = [[[PauseLayer alloc] initWithScene:scene2] autorelease];
27 [scene addChild:layer];
28
29 return scene;
30}
31
32- (id)initWithScene:(CCScene*)scene
33{
34 self = [super init];
35
36 if (nil != self)
37 {
38 game = [scene retain];
39
40 CCLabelBMFont* scoreLabel = [CCLabelBMFont labelWithString:@"PAUSE" fntFile:@"helvetica.fnt"];
41 scoreLabel.position = ccp(240,90);
42 [self addChild:scoreLabel];
43
44 CCMenuItemImage* pauseButton = [CCMenuItemImage itemFromNormalImage:@"pause2.png" selectedImage:@"pause.png" target:self selector:@selector(unpause)];
45 CCMenu* pauseMenu = [CCMenu menuWithItems:pauseButton, nil];
46 [pauseMenu setPosition:ccp(480-8-16, 320-8-16)];
47 [self addChild:pauseMenu];
48
49 CCMenuItemImage* newgameMenuItem = [CCMenuItemImage itemFromNormalImage:@"back.png" selectedImage:@"back2.png" target:self selector:@selector(newgame)];
50 CCMenu* myMenu = [CCMenu menuWithItems:newgameMenuItem, nil];
51 myMenu.position = ccp(240, 60);
52 [self addChild:myMenu];
53 }
54
55 return self;
56}
57
58- (void)unpause
59{
60 [[CCDirector sharedDirector] replaceScene:game];
61}
62
63- (void)newgame
64{
65 [[CCDirector sharedDirector] replaceScene:[MainMenuLayer scene]];
66}
67
68@end