Adding gesture recognizer (or dragging) to CCSprite
Posted
by
user339946
on Game Development
See other posts from Game Development
or by user339946
Published on 2012-05-18T14:56:32Z
Indexed on
2012/10/06
21:57 UTC
Read the original article
Hit count: 187
I'm trying to allow a CCSprite to be dragged across the screen. I've succeeded so far by doing it on a Layer level (from this tutorial). However, this only allows ONE sprite to be dragged at a time as the method implementation can only identify a single sprite to move at a time.
I'd like to be able to perhaps add a gesture recognizer or somehow implement ccTouchesBegan/Moved in my own little CCSprite subclass.
However, from what I understand, you can't just add gesture recognizers to CCSprites. ccTouchMoved are also not available on CCSprites?? Really confused as to how to implement touches on Cocos2D.
What is the easiest way to add some position translation code to a CCSprite so it can be dragged around? Thanks!
© Game Development or respective owner