次のコードを使用して、アプリでスプライトを移動します。
- (void) ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
CGPoint touchLocation = [self convertTouchToNodeSpace:touch];
CGPoint oldTouchLocation = [touch previousLocationInView:touch.view];
oldTouchLocation = [[CCDirector sharedDirector] convertToGL:oldTouchLocation];
oldTouchLocation = [self convertToNodeSpace:oldTouchLocation];
CGPoint translation = ccpSub(touchLocation, oldTouchLocation);
CGPoint newPos = ccpAdd(self.position, translation);
self.position = newPos;
}
正常に動作しますが、ファインダーが画面上にあるとスプライトが移動します。
私が実現したいのは、iOS の組み込みアプリのように、スワイプ後のある種の勢いです。
誰かがそれを行う方法のヒントを教えてもらえますか?