objective c - CCLayer keeps shifting position -
i using cocos2d , have following code moves layer based on player touching screen. reason, each time code called position of layer shifts 32 in 1 direction or other. cant fathom why happening. there no other code anywhere in program manipulates position of these ccnodes (or 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 how move actions play-out if set position while action in progress, case here.
Comments
Post a Comment