I am using cocos2d and have the following code which moves my layer based on the player touching the screen. For some reason, each time the code is called the position of the layer shifts by 32 in one direction or the other. I cant fathom why its happening. There is no other code anywhere in the program that manipulates the position of these CCNodes (or any other Node).
-(void) animateStructure:(int)index And:(CCSprite*)aSprite At:(CGPoint)aPoint {
CGPoint point1 = self.position;
CGPoint point2 = playerSprite.position;
id move = [CCMoveBy actionWithDuration:0.1 position:ccp(32*tempx,32*tempy)];
[self runAction:move];
id move2 = [CCMoveBy actionWithDuration:0.1 position:ccp(-32*tempx,-32*tempy)];
[playerSprite runAction:move2];
self.position = point1;
playerSprite.position = point2;
}
not certain how the move actions will play-out if you set the position while the action is in progress, as is the case here.