-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGameScene.m
39 lines (35 loc) · 822 Bytes
/
GameScene.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// MenuScene.m
// SimpleGame
//
// http://monoclestudios.com/cocos2d_whitepaper.html
// This is free software - see LICENSE for details
//
#import "GameScene.h"
#import "MenuScene.h"
@implementation GameScene
- (id) init {
self = [super init];
if (self != nil) {
Sprite * bg = [Sprite spriteWithFile:@"game.png"];
[bg setPosition:ccp(240, 160)];
[self addChild:bg z:0];
[self addChild:[GameLayer node] z:1];
}
return self;
}
@end
@implementation GameLayer
- (id) init {
self = [super init];
if (self != nil) {
isTouchEnabled = YES;
}
return self;
}
- (BOOL)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
MenuScene * ms = [MenuScene node];
[[Director sharedDirector] replaceScene:ms];
return kEventHandled;
}
@end