Search code examples
cocos2d-iphonetouchspritelayercocos2d-x

cocos2d subclassing sprite to handle touch?


I'm new to the cocos2d(-x) world.

I'd like to detect a touch to a sprite, and tutorials/examples seem to suggest using layer to detect touch and find the approapriate sprite with bounding box.

Is subclassing sprite to allow touch detection generally a bad idea?


Solution

  • it is better and much more clear to handle touches in one place. but i think, no one can bar you to do this