Note that there are some explanatory texts on larger screens.

plurals
  1. PODetecting 2 swipes without interrupting touch
    primarykey
    data
    text
    <p>I am trying to implement game control that will be changes direction of unit movement. So if i do right swipe it turns to the right, if i do down swipe it turns to the down direction etc.</p> <p>It's cocos2d game, and i'am using <code>CCNode+SFGestureRecognizers</code> with <code>UISwipeGestureRecognizer</code>.</p> <p>At now I have next implementation for it</p> <pre><code>UISwipeGestureRecognizer *rightSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleRightSwipe:)]; [self addGestureRecognizer:rightSwipeGestureRecognizer]; rightSwipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionRight; rightSwipeGestureRecognizer.delegate = self; [rightSwipeGestureRecognizer release]; UISwipeGestureRecognizer *upSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleUpSwipe:)]; [self addGestureRecognizer:upSwipeGestureRecognizer]; upSwipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionUp; upSwipeGestureRecognizer.delegate = self; [upSwipeGestureRecognizer release]; UISwipeGestureRecognizer *leftSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleLeftSwipe:)]; [self addGestureRecognizer:leftSwipeGestureRecognizer]; leftSwipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionLeft; leftSwipeGestureRecognizer.delegate = self; [leftSwipeGestureRecognizer release]; UISwipeGestureRecognizer *downSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleDownSwipe:)]; [self addGestureRecognizer:downSwipeGestureRecognizer]; downSwipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionDown; downSwipeGestureRecognizer.delegate = self; [downSwipeGestureRecognizer release]; </code></pre> <p>but the problem is that for to recognize the following gesture you need to lift your finger from the screen. if you do not lift a finger after the first swipe, it will recognize only the first swipe.</p> <p><strong>at now:</strong></p> <p><img src="https://i.stack.imgur.com/1MUUx.png" alt="enter image description here"></p> <p><strong>How it should be:</strong></p> <p><img src="https://i.stack.imgur.com/OAtM4.png" alt="enter image description here"></p> <p>What the best way to do that? Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload