I am trying to do something fairly simple in Cocos2d 3.1. I am receiving touch events on a CCSprite subclass and I am trying to stop receiving touch events when the touch is slid off of the sprite using a simple containsTouchLocation
helper method.
What is not working however is if I do self.userInteractionEnabled = NO;
in the touchMoved:
method, it still calls touchMoved!
This is my full touchMoved: method:
- (void)touchMoved:(UITouch *)touch withEvent:(UIEvent *)event {
self.userInteractionEnabled = NO;
int color = ([self containsTouchLocation:touch] ? 128 : 255);
self.color = [CCColor colorWithCcColor3b:ccc3(color, color, color)];
}
Why is it that even though I am clearly trying to turn off touch events in the touchMoved method, it is still calling it?