【问题标题】:popscene in cocos2d problemscocos2d中的popscene问题
【发布时间】:2011-06-17 08:44:12
【问题描述】:

我是 cocos2d 的新手。在我的游戏中,我使用“cctouchesbegan”推送新场景。使用“popScene”从第二个场景进入我的第一个场景。进入第一个场景后,我的“cctouchesbegan”委托方法不起作用...如果有任何想法,将会有所帮助。

【问题讨论】:

    标签: iphone xcode ipad cocos2d-iphone


    【解决方案1】:

    在添加 targettedDelegate 时输入“NO”,如下所示。它纠正了我的错误 [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0swallowsTouches:NO]

    【讨论】:

      【解决方案2】:

      您可以执行以下操作:

      -(void)onEnter
      {
          [super onEnter];
      
      
          [[CCTouchDispatcher sharedDispatcher] removeDelegate: self];
          [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
          self.isTouchEnabled = YES;
      }
      
      
      - (void) onExit {
      
          [[CCTouchDispatcher sharedDispatcher] removeDelegate: self];
          [super onExit];
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多