2013-05-13 12 views
0

anyTouchEndedThisFrame必须是越野车我已经尝试了所有的一切,现在它只会认为一个接触,如果我移动手指,如果我触摸并放弃在同一个地方,它不会reckonize它,如果我说错了请纠正我Kobold2d:KKInput anyTouchEndedThisFrame

-(void) moveObjectToNewPosition:(KKInput *)input 
{ 
    if (input.anyTouchEndedThisFrame) { 
     [self touchesEnded:[input locationOfAnyTouchInPhase:KKTouchPhaseAny]]; 

    } if (input.anyTouchBeganThisFrame) { 
     [self touchesBegan:[input locationOfAnyTouchInPhase:KKTouchPhaseBegan]]; 
    } 

回答

1

它甚至从来没有工作对我来说,你应该实现此方法,它是利用

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

嗯..这似乎是使用cocos2d的输入以及 – 2013-05-13 12:41:07

+0

工作现在,我还没有禁用KKInput – 2013-05-13 12:48:13

+0

我很高兴地听到,它的工作原理相同的问题,可能你记住我的答案接受?谢谢 – Filoo 2013-05-13 13:35:38