Cocos2d iphone 应用程序中使用的滑动手势

Cocos2d iphone 应用程序中使用的滑动手势,cocos2d-iphone,Cocos2d Iphone,我对使用刷卡手势有异议 问题是,我想在按住“单击”的同时执行左右滑动,将方向更改为左右 在这种情况下,我可以使用CCTouch方法吗?如果是,那么我如何使用它?还有其他方法吗?我正在使用60幅图像创建动画,看起来像是3d建模。但我的问题是,当我单击向左滑动时,突然我将滑动方向更改为向右。实际上,它会在向左滑动时停止,并移向向右,但不会发生这样的情况。请回复,因为我仍然有problem@Leena,没有得到你想要的东西..我用上面的代码在游戏中检测刷卡,它在cocos2d游戏中起作用。是的,我知道

我对使用刷卡手势有异议

问题是,我想在按住“单击”的同时执行左右滑动,将方向更改为左右


在这种情况下,我可以使用CCTouch方法吗?如果是,那么我如何使用它?还有其他方法吗?

我正在使用60幅图像创建动画,看起来像是3d建模。但我的问题是,当我单击向左滑动时,突然我将滑动方向更改为向右。实际上,它会在向左滑动时停止,并移向向右,但不会发生这样的情况。请回复,因为我仍然有problem@Leena,没有得到你想要的东西..我用上面的代码在游戏中检测刷卡,它在cocos2d游戏中起作用。是的,我知道,但我的问题是不同的。当我向左滑动时,我想要这样的东西,然后动画只发生在左侧,帧只传递滑动量。在上面的回答中,将UISWEEgestureRecognitizerDirectionUp替换为UISWEEgestureRecognitizerDirectionLeft。然后你获得左击的控制权,然后播放相应的动画…要检测左击和右击,你需要创建并使用两个击手势识别器,一个用于左击,一个用于右击swipes@LearnCocos2D,先生,请阅读我的回答和评论
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{
  ...
  ...
     [self createSwipeRecognizerView];

     return YES;

}



-(void) createSwipeRecognizerView {
    //NSLog(@"Creating Swipe Recognizer");

    UIGestureRecognizer *recognizer;
    recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(screenDidswipe)];
    // swipeRightOnTable is the callback method in my case

    swipeRecognizer = (UISwipeGestureRecognizer *)recognizer;
    // select swipe direction
    swipeRecognizer.direction = UISwipeGestureRecognizerDirectionUp;

    [self.navController.view addGestureRecognizer:recognizer];
    recognizer.delegate = self;
    [recognizer release];
}

    -(BOOL) gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch 
    {
        if([[MyGame sharedGameObject].layer isKindOfClass:[MyGameScreen class]])
            return YES;
        return NO;
    }

    -(void) screenDidswipe 
    {
        MyGame *sGame = [MyGame sharedGameObject];
        if([sGame.layer isKindOfClass:[MyGameScreen class]])
        {
            [(MyGameScreen*)(sGame.layer) screenDidswipe];
        }
    }