我已经实现了在我的游戏中的偷偷摸摸/运动鞋输入文件,我已经做了一个操纵杆。我还添加了一个按钮,一个CCMenuItem
- (void)initJoystick {
SneakyJoystickSkinnedBase *joystickBase = [[SneakyJoystickSkinnedBase alloc] init];
joystickBase.backgroundSprite = [CCSprite spriteWithFile:@"base.png"];
joystickBase.thumbSprite = [CCSprite spriteWithFile:@"joystick.png"];
joystickBase.joystick = [[SneakyJoystick alloc] initWithRect:CGRectMake(0, 0, 128, 128)];
joystickBase.position = ccp(90, 90);
[self addChild:joystickBase z:1000];
leftJoystick = [joystickBase.joystick retain];
CCLabelTTF *shootLabel = [[CCLabelTTF alloc] initWithString:@"Shoot" fontName:@"helvetica" fontSize:32.0];
CCMenuItem *shootItem = [CCMenuItemLabel itemWithLabel:shootLabel target:self selector:@selector(shootTapped)];
shootItem.color = ccORANGE;
CCMenu *menu = [CCMenu menuWithItems:shootItem, nil];
menu.position = ccp(500, 25);
[self addChild:menu z:1000];
}操纵杆工作正常,但当我移动它时,按钮无法识别任何按键。当我有CCMenuItems而不是操纵杆时,另一个按钮可以正常工作,但与操纵杆不一样。那么,是否有人熟悉这些鬼鬼祟祟的文件,或者有人知道我如何使这两个文件同时可点击?
发布于 2014-01-06 22:53:42
https://stackoverflow.com/questions/20933245
复制相似问题