2011-02-28 43 views

回答

1

在ccTouchesMoved添加一个全局变量在你ccTouchesBegan,

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

只使用指定startPosition检查您的手是否移动

0
- (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]; 
} 

你可以做这样的:)

相关问题