1
我正在使用cocos2d。如何获得最后的触摸ccTouchesMoved?如何获得ccTouchesMoved的最后一次触摸?
我正在使用cocos2d。如何获得最后的触摸ccTouchesMoved?如何获得ccTouchesMoved的最后一次触摸?
在ccTouchesMoved添加一个全局变量在你ccTouchesBegan,
CGPoint touchPoint = [touch locationInView:[touch view]];
startPosition = [[CCDirector sharedDirector] convertToGL:touchPoint];
只使用指定startPosition检查您的手是否移动
- (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];
}
你可以做这样的:)