【问题标题】:Kobold2d: KKInput anyTouchEndedThisFrameKobold2d: KKInput anyTouchEndedThisFrame
【发布时间】:2013-05-13 09:53:12
【问题描述】:

anyTouchEndedThisFrame 一定是有问题的,如有错误请指正

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

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

【问题讨论】:

    标签: cocos2d-iphone kobold2d


    【解决方案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 {
    
    }
    

    并添加到您的初始化中:

    [self setTouchEnabled:YES];
    

    【讨论】:

    • hmm.. 使用 cocos2d 输入似乎也是同样的问题
    • 现在工作,我没有禁用 KKInput
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多