2013-05-13 54 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