开发者

popscene in cocos2d problems

开发者 https://www.devze.com 2023-03-13 11:21 出处:网络
i am new to cocos2d.In my game am using \"cctouchesbegan\" to push a new scene.Using \"popScene\" am coming to my first scene fromsecond scene.After coming to first scene开发者_如何学C my \"cctouchesb

i am new to cocos2d.In my game am using "cctouchesbegan" to push a new scene.Using "popScene" am coming to my first scene from second scene.After coming to first scene开发者_如何学C my "cctouchesbegan" delegate method not working... If any idea,it will be helpful .


put "NO" when you are adding the targettedDelegate as shown below.It corrects my error [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:NO]


You can do the following:

-(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];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消