I am using some code to move a CCTMXTiledMap:
-(void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
NSSet *allTouches = [event allTouches];
switch ([allTouches count]) {
case 1:
break;
case 2:
UITouch *f1 = [[allTouches allObjects] objectAtIndex:0];
UITouch *f2 = [[allTouches allObjects] objectAtIndex:1];
CGPoint f1l = [f1 locationInView:[f1 view]];
CGPoint f1lp = [f1 previousLocationInView:[f1 view]];
CGPoint f2l = [f2 locationInView:[f1 view]];
CGPoint f2lp = [f2 previousLocationInView:[f2 view]];
if ([self isPinchingFirstPoints1:f1l two:f1lp secondPoints1:f2l two:f2lp]) {
} else {
CCNode *node = [self getChildByTag:kTagBackground];
CGPoint currentPos = [node position];
CGPoint diff = ccpSub(f1l, f1lp);
int boundLineNewXPos = boundaryLine.position.x + diff.x;
boundaryLine.position = ccp(boundLineNewXPos, boundaryLine.position.y);
[node setPosition:ccpAdd(currentPos, diff)];
}
break;
}
}
The problem is that when i try to move the map upwards, it moves sideways, and when i try to move sideways, it moves upwards