Is there a way to detect touch events from another class than the Layer itself.
I’m trying to have a state controlling the interaction, adding listener to the layer itself if needed instead of have the layer call a function on the current state, which might be a noop.
Is the a way to use such a thing?
Is there a way to detect touch events from another class than the Layer
Share
See the class
CCTouchDispatcher(http://www.cocos2d-iphone.org/api-ref/latest-stable/interface_c_c_touch_dispatcher.html)You can subscribe any class that implements
CCStandardTouchDelegateorCCTargetedTouchDelegateto receive touch events, by calling:on your
onEntermethod (assuming your class is aCCNode), and then remove it from the dispatcher via:at your
onExitmethod.