ios - Sprite kit double tap detection -


I am using spritekit for my game, using the following code to detect single tap and double tap :

  - (zero) touch touch: (NSSET *) touches the event: (UIEvent *) event {UIT * touch = [touches any object]; If (touch.tapCount == 1) {[self.tapQueue addObject: @ 1]; NSLog (@ "touchtapcount == 1"); } If (touch.tapCount == 2) {[self.tapQueue addObject: @ 2]; NSLog (@ "touch.tapCount == 2 :)"); }} - (Zero) Process User Top For Update: (NSEInInternval) for Onetime ([Self-Tape Qi Copy] in NSN * Tapcount) {If ([Taxcountry unsigned ETGER value] == 1) [Self-SingleTap]; If ([Tapcount unsigned intangiar value] == 2) [Double Double Tap]; [Object removed from Self.tapQueue: Tapcount]; }}  

This code detects a single tap, but when it detects double tap it detects a single tap with it. How do I differentiate between single tap and double tap?

Thanks

Are you saying that once during double tap a Bar tap is reported, once for tap and twice for tap, before reporting double tap?

In addition to answering your question, create a global tapac, instead of being dependent on tapaccount from touch event or tap a boolean var once you check to make sure that its Double taped.


Comments