在class1“init”方法中写了两个overLapping按钮(底部代码),但是这两个按钮被添加到(addChild)另一个类(class2)
如果我按下按钮(按钮)。两个按钮可以同时响应两个事件吗?
我希望 button1 响应 class1 方法
button2 响应 class2 方法
什么是这样做的好方法?
-(id)initWithPosition:(CGPoint)aPoint Mene:(CCMenu *)menu Fun:(SEL)fun
{
id aTarget = [menu parent];
NSString * imageName = @"light.png";
CCSprite* sprite1 = [CCSprite spriteWithSpriteFrameName:imageName];
CCSprite* sprite2 = [CCSprite spriteWithSpriteFrameName:imageName];
self.flashitemSprite=[CCMenuItemSprite itemWithNormalSprite:sprite1 selectedSprite:sprite2 target:aTarget selector:fun];
sprite1.visible=YES;
_flashitemSprite.position = _flashSprite.position;
[menu addChild:self.flashitemSprite];
CCSprite* sprite3 = [CCSprite spriteWithSpriteFrameName:imageName];
CCSprite* sprite4 = [CCSprite spriteWithSpriteFrameName:imageName];
self.aItemSprite =[CCMenuItemSprite itemWithNormalSprite:sprite3 selectedSprite:sprite4 target:self selector:@selector(distroy)];
sprite3.visible=YES;
_aItemSprite.position = _flashSprite.position;
[menu addChild:self.aItemSprite];
return self;
}