我得到这个错误实例方法'-setTouchEnabled:'未找到(返回类型默认为'id')我不知道是什么导致它,任何帮助将不胜感激:)如果它混乱,我的代码很抱歉
- (id) init
{
if ((self = [super init])) {
CGSize winSize = [CCDirector sharedDirector].winSize;
CCSprite *player = [CCSprite spriteWithFile:@"start.png"];
player.position = ccp(player.contentSize.width/2, winSize.height/2);
[self addChild:player];
[self schedule:@selector(gameLogic:) interval:0.5];
[self setTouchEnabled:YES];
_monsters = [[NSMutableArray alloc] init];
_projectiles = [[NSMutableArray alloc] init];
// stuff that needs updating
[self schedule:@selector(update:)];
//labels
StrategyBullet = 10;
Strategyscore = 0;
CCLabelTTF *label2 = [CCLabelTTF labelWithString:@"Ninja stars " fontName:@"Arial" fontSize:15];
label2.position = ccp(400,310);
label2.color = ccc3(255, 0, 0);
[self addChild: label2 z:1];
CCLabelTTF *label = [CCLabelTTF labelWithString:@"Score" fontName:@"Arial" fontSize:15];
label.position = ccp(30,310);
label.color = ccc3(255, 0, 0);
[self addChild: label z:1];
StrategyscoreLabel = [CCLabelTTF labelWithString:@"0" fontName:@"Arial" fontSize:14];
StrategyscoreLabel.position = ccp(65, 310);
StrategyscoreLabel.color = ccc3(255, 255, 255);
[self addChild:StrategyscoreLabel z:1];
StrategyBulletLabel = [CCLabelTTF labelWithString:@"0" fontName:@"Arial" fontSize:14];
StrategyBulletLabel.position = ccp(450, 310);
StrategyBulletLabel.color = ccc3(255, 255, 255);
[self addChild:StrategyBulletLabel z:1];
}
return self;
}