Best way to prevent UIPanGestureRecognizer from firing when moving sprites in cocos2d

Posted by cjroebuck on Game Development See other posts from Game Development or by cjroebuck
Published on 2011-03-04T16:00:01Z Indexed on 2011/03/04 23:33 UTC
Read the original article Hit count: 289

Filed under:
|

Im using UIPanGestureRecognizer in my cocos2d game to do drag and drop of sprites. I have a row of sprites and when I drag a sprite on top of another one, the sprite underneath it and any other sprites between should shift left or right out of the way to allow space to drop the currently selected sprite.

This is working ok, however, if I am too quick at dragging the sprite around the screen, this triggers another round of the UIPanGestureRecognizer's callback method, and screws up the logic, as the sprites are in-between shifting.

I need a way to freeze the callback from firing, whilst the other sprites are shifting, then once they have finished moving, re-enable the callback to fire.

Whats the best way to do this?

© Game Development or respective owner

Related posts about cocos2d-iphone

Related posts about cocos2d