Detect Tap on Sprite in Cocos2d -


i have cocos2d game has between 4 - 12 sprites users can interact (either drag , drop or tap). if user taps on 1 of sprites, i'd sprite move it's previous position (prior being dragged , dropped). there way detect tap vs. drag action?

using touch delegate create boolean of isdrag , set in "ccmoved". check in "cctouchended". e.g

(bool)cctouchbegan:(uitouch *)touch withevent:(uievent *)event {  return yes; 

}

(void)cctouchmoved:(uitouch *)touch withevent:(uievent *)event {

isdrag = yes; 

}

(void)cctouchended:(uitouch *)touch withevent:(uievent *)event {

if(isdrag){

 }else{   } 

}


Comments