Mange to scroll my CCLayers with parallax node but how do I set the bounds of the scroll?
Using:
- (void)registerWithTouchDispatcher {
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:1 swallowsTouches:NO];
}
-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event {
return YES;
}
-(void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event
{
CGPoint touchLocation = [touch locationInView: [touch view]];
CGPoint prevLocation = [touch previousLocationInView: [touch view]];
touchLocation = [[CCDirector sharedDirector] convertToGL: touchLocation];
prevLocation = [[CCDirector sharedDirector] convertToGL: prevLocation];
CGPoint diff = ccpSub(touchLocation,prevLocation);
CCNode *node = [self getChildByTag:kTagNode];
CGPoint currentPos = [node position];
[node setPosition: ccpAdd(currentPos, diff)];
}
You could set the swallowsTouches property of the ZoomController and look at the TargetTouchDelegate to handle more complicated touch events.