Как получить последний штрих в ccTouchesMoved? - PullRequest
1 голос
/ 28 февраля 2011

Я работаю с cocos2d. Как получить последний штрих в ccTouchesMoved?

Ответы [ 2 ]

1 голос
/ 28 февраля 2011

Добавьте глобальную переменную в ваш ccTouchesBegan,

CGPoint touchPoint = [touch locationInView:[touch view]];
startPosition = [[CCDirector sharedDirector] convertToGL:touchPoint];

в ccTouchesMoved просто используйте startPosition, чтобы проверить, сдвинулась ли ваша рука

0 голосов
/ 31 января 2013
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [[touches allObjects] objectAtIndex: 0];
    // The last location you touch
    CGPoint lastLocation = [touch previousLocationInView:self.view];
    // Current location
    CGPoint currentLocation = [touch locationInView:self.view]; 
}

Вы можете сделать так:)

...