3

How can I make swipe gestures in cocos2d iphone/ipad in all directions? When swipe touches (passes at) on a sprite I want to perform a function at that time, like i want to cut that object when swipe at that sprite.

Janak Nirmal
  • 22,706
  • 18
  • 63
  • 99
Burhan Ahmad
  • 728
  • 5
  • 13

2 Answers2

3

You should look for cocos2d and gesture recognizer. Check this post

cocos2d-iOS - Gesture recognisers

and google will help too...

Community
  • 1
  • 1
Sebastián Castro
  • 1,408
  • 10
  • 28
1

UISwipeGestureRecognizer might give you a problem because it only supplies you with the coordinates of the place where the swipe started (it only calls a handler once per swipe).

See: http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UISwipeGestureRecognizer_Class/Reference/Reference.html

I would use UIPanGestureRecognizer. This calls a handler every time the pan is updated (i.e. every time the finger moves during the swipe). You can then figure out which sprite your pan/swipe is passing over.

Danyal Aytekin
  • 4,106
  • 3
  • 36
  • 44