我在这里为我的游戏创建一个主菜单它无法编译但我不明白为什么
// Main Menu.m
//
//
//
#import "MainMenu.h"
#import "CCTouchDispatcher.h"
#import "Instructions.h"
CCSprite *seeker1;
CCSprite *cocosGuy;
@implementation MainMenu
+ (CCScene *) scene
{
CCScene * scene = [CCScene node]; // scene is an autorelease object
MainMenu * layer = [MainMenu node]; // later is an autorelease object
[scene addChild: layer]; // add layer as a child to scene
return scene; // return the scene
}
- (id) init
{
if ( ( self = [super init] ) )
{
[ self setUpMenus ];
}
return self;
}
- (void) setUpMenus
{
// create menu items
CCMenuItemImage * startButton = [CCMenuItemImage itemFromNormalImage:@"startbutton.png"
selectedImage:@"startbutton_selected.png"
target: self
selector: @selector (doSomethingOne:)];
CCMenuItemImage * instructionsButton = [CCMenuItemImage itemFromNormalImage:@"instructionsbutton.png"
selectedImage:@"instructionbutton_selected.png"
target: self
selector: @selector(doSomethingTwo:)];
CCMenuItemImage * unlockList = [CCMenuItemImage itemFromNormalImage: @"unlocklist.png"
selectedImage:@"unlocklist_selected.png"
target: self
selector: @selector(doSomethingThree:)];
// create the menu and add the items to it
CCMenu * myMenu = [CCMenu menuWithItems: startButton, instructionsButton, unlockList,nil];
// arrange the items vertically
[myMenu alignItemsVertically];
// add the menu to the scene
[self addChild:myMenu];
}
- (void) doSomethingOne: (CCMenuItem *) menuItem
{
}
- (void) doSomethingTwo: (CCMenuItem *) menuItem
{
[[CCDirector sharedDirector] replaceScene:
[CCTransitionFade transitionWithDuration:0.5f scene:[Instructions scene] ]];
}
- (void) doSomethingThree: (CCMenuItem *) menuItem
{
}
@end
为什么我会收到选择器场景没有已知类方法的错误?关于doSomethingTwo。我必须在 .h 文件中导入一些东西吗?还是一个实现?感谢您为我提供的任何帮助。