当按下操纵杆时,偷偷摸摸地不读取按钮

时间:2012-11-02 06:35:21

标签: iphone xcode cocos2d-iphone

我遇到了SneakyJoystick和SneakyButton的问题。当操纵杆被按下时,SneakyButton没有被按下,我想知道如何解决这个问题。我假设多点触控允许同时读取两个输入。在我当前的项目中,每当按下操纵杆时,角色就会朝那个方向移动,但是当操纵杆按下时我似乎无法按下偷偷摸摸的按钮。

继承我对InputLayer的更新方法:

GameLayer *game = [GameLayer sharedGameLayer];
Hero* hero =[game getHeroFromLayer];
if (attackButton.active)
{
    [hero attack];
}


CGPoint velocity = ccpMult(dPad.velocity, 6500 * dt);
hero.position = ccp(hero.position.x + velocity.x * dt,
                    hero.position.y + velocity.y * dt);

2 个答案:

答案 0 :(得分:1)

苏杜德?你应该尝试改变

if (attackButton.active)

if (attackButton.value == 1)

答案 1 :(得分:0)

谢谢,努诺。

经过许多天的努力,如何同时触摸操纵杆和“攻击/跳跃”按钮,但完全失败。到目前为止,我触摸了此评论,只需打开多点触摸,一切正常!!!

在此处更改: RootViewController.mm => [eaglView setMultipleTouchEnabled:YES]

相关问题