Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 56 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. ccTouchesMoved adds object to array multiple times, even though an if statement should avoid that
  2. -(void) ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
  3. {
  4.     UITouch *myTouch = [touches anyObject];
  5.     CGPoint location = [myTouch locationInView:[myTouch view]];
  6.     CGPoint convertedLocation = [[CCDirector sharedDirector] convertToGL:location];
  7.  
  8.     CCSprite* realSprite = [self whichHexagonTouched:convertedLocation];
  9.  
  10.     NSNumber *hexTag = [NSNumber numberWithInt:realSprite.tag];
  11.  
  12.     // If the hexagon is not in the array and not nil, it should destroy it and add it to the array
  13.  
  14.     if(realSprite != nil && ![hexTags containsObject:hexTag]){
  15.         [self destroyHexagon:realSprite];    
  16.         [hexTags addObject:hexTag];
  17.  
  18.         NSLog(@"these are the hexTags %@", hexTags);
  19.         }
  20.  
  21.  
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top