Hi,
I've done everything suggested but still no joy.
I've based my own code on the Pong demo supplied in v0.8 and so there cannot be too much wrong with it.
To recap, I've done all of the following:
// Added in my AppDelegate class
[[TouchDispatcher sharedDispatcher] setDispatchEvents: YES];
// Implemented the correct method in my main scene and layer class
- (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
if(mySprite1.state == kMenuOptionStateGrabbed) {
NSLog(@"SPRITE TOUCHED");
return kEventHandled;
}
return kEventIgnored;
}
// In my class that sub classes TextureNode (like the Pong demo does) the relevant handling methods are:
- (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
state = kMenuSpriteStateGrabbed;
return kEventIgnored;
}
- (void)ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event
{
state = kMenuSpriteStateUngrabbed;
}
Additional notes...
I've debugged the app and the 'onEnter' method is definitely being called before each sprite is added to the layer.
My implementation for this method is:
- (void)onEnter
{
[[TouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:NO];
[super onEnter];
}
Note, it doesn't matter if 'swallowsTouches' is set to YES or NO in this method, it still doesn't work.
Dan