I'm trying to implement ccTouchesBegan in my GameScene.

I've set isTouchEnabled = YES. I'm also calling addStandardDelegate on the touchDispatcher. Finally, in my AppDelegate i have [glView setMultipleTouchEnabled:YES].

However, ccTouchesBegan is never called.

What am I doing wrong?

有帮助吗?

解决方案

Solved it!

I was registering touches on a previous layer, but the layer wasn't being dealloced because you have to "un-register" with the onExit method.

Long story short: touchesBegan was not being called on my GameLayer because it was being swallowed by another layer.

其他提示

Create one dummy application and try this:

@protocol CCStandardTouchDelegate <NSObject>
@optional
- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)ccTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
@end

May be it will help you..

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top