我試圖在我的GameScene中實現ccTouchesBegan
。ccTouchesBegin not called
我設置isTouchEnabled = YES
。我還打電話addStandardDelegate
在touchDispatcher
。最後,在我的AppDelegate
我有[glView setMultipleTouchEnabled:YES]
。
但是,ccTouchesBegan永遠不會被調用。
我在做什麼錯?
我試圖在我的GameScene中實現ccTouchesBegan
。ccTouchesBegin not called
我設置isTouchEnabled = YES
。我還打電話addStandardDelegate
在touchDispatcher
。最後,在我的AppDelegate
我有[glView setMultipleTouchEnabled:YES]
。
但是,ccTouchesBegan永遠不會被調用。
我在做什麼錯?
解決它!
我正在註冊上一層的觸摸,但該層並沒有被處理,因爲您必須使用onExit
方法「取消註冊」。
長話短說:touchesBegan
,因爲它正被另一個層吞食沒有被叫上我的GameLayer。
創建一個虛擬應用程序並嘗試這個辦法:
@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
可能它會幫助你..