anyTouchEndedThisFrame肯定有问题我已经试过所有的方法了,如果我移动手指,它只会计算一个触摸结束,如果我在同一地点触摸并松开,它不会计算它,如果我错了,请纠正我
-(void) moveObjectToNewPosition:(KKInput *)input
{
if (input.anyTouchEndedThisFrame) {
[self touchesEnded:[input locationOfAnyTouchInPhase:KKTouchPhaseAny]];
} if (input.anyTouchBeganThisFrame) {
[self touchesBegan:[input locationOfAnyTouchInPhase:KKTouchPhaseBegan]];
}发布于 2013-05-13 19:59:27
即使对我来说,它也从来没有起过作用,你应该实现这个非常简单的方法。
-(void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSSet *allTouches = [event allTouches];
UITouch * touch = [[allTouches allObjects] objectAtIndex:0];
CGPoint location = [touch locationInView: [touch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
}
-(void) ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
}
-(void) ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
}并将以下内容添加到init中:
[self setTouchEnabled:YES];https://stackoverflow.com/questions/16519219
复制相似问题