私が知っているように、moveTo
メソッドを使用してスプライトをアニメーション化するべきではありません。「moveto」を使用すると、移動がスムーズではないことに気付きませんでしたか?
私はこのようにしていますが、完璧ではないかもしれません。
- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *myTouch = [touches anyObject];
CGPoint location = [zoombase convertTouchToNodeSpace:myTouch];
self.destinationLocation = loaction;
}
-(void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *myTouch = [touches anyObject];
CGPoint location = [zoombase convertTouchToNodeSpace:myTouch];
self.destinationLocation = loaction;
}
-(void)update:(ccTime)dt {
//that will do until your sprite reach you destination point
if(!CGPointEqualToPoint(self.spriteToMove,self.destinationLocation)) {
CGPoint *stepToMove = ccp(0.2/destinationLocation,0.2/destinationLocation); //some piece of orginal destination
[self.spriteToMove setPosition:ccpAdd(stepToMove,self.spriteToMove.position)]; // add that pice to your sprite current location
}
}