2

Im working on a game in cocos2d where two people tap on the screen at the same time in different places and each tap counts as a different action?

This is my current code, which doesn't allow the two taps to be counted at the same time:

-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *myTouch = [touches anyObject];
    CGPoint point = [myTouch locationInView:[myTouch view]];
    point = [[CCDirector sharedDirector] convertToGL:point];

    if (point.y > 512) {
        score += 1;
        [scoreLabel setString:[NSString stringWithFormat:@"%i", score]];
    }
    if (point.y < 512) {
        score2 += 1;
        [scoreLabel2 setString:[NSString stringWithFormat:@"%i", score2]];
    }
mattblessed
  • 772
  • 1
  • 12
  • 27

1 Answers1

0

I added the following code to my appdelegate to handle multi-touch:

[glView setMultipleTouchEnabled:YES];
mattblessed
  • 772
  • 1
  • 12
  • 27