cocos2d-iPhone simple to check if the touch input was right swipe
-(BOOL)wasSwipeRight:(NSSet*)touches :(UIEvent*) event { NSSet *allTouches = [event allTouches]; if(1 != [allTouches count]) return FALSE; UITouch *touch = [[allTouches allObjects] objectAtIndex:0]; CGPoint start = [touch previousLocationInView:[touch view]]; CGPoint end = [touch locationInView:[touch view]]; start = [self rotateRealWorld:start]; end = [self rotateRealWorld:end]; if(start.x < end.x) { return TRUE; } return FALSE; }
Log in to answer.
leothenerd 5:39 pm on January 3, 2010