I I’m working on a game in Cocos2D and I have a CCSprite Subclass with CCTargetedTouchDelegate wich is implemented so I can drag the sprite around on screen. I want the sprite to lock in it’s position once the user’s finger leaves the screen. Is there any way I can do this?? In the ccTouchEnded method I’d guess? Thank you!
Share
Add a
bool lockvariable to your class fields. Make itfalsein yourinitmethod.In touchBegan and touchMoved methods check
if (!lock) {your code }. In touchEnded make ittrue.