2011-12-22 9 views
0

視差ノードでCCLayersをスクロールするMangeですが、スクロールの境界をどのように設定しますか?オフスクリーンの視差ノードcclayersでのスクロール

使用:

- (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)]; 

} 

答えて

0

あなたはZoomControllerのswallowsTouchesプロパティを設定し、より複雑なタッチイベントを処理するためにTargetTouchDelegateで見ることができます。

+0

しかし、どのように私はそれらを同じ時間に持つことができますか?私の視差画像は大きく、右にスクロールすると逆方向のスプライトがあり、それに到達できません... –