Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ccTouchesMoved adds object to array multiple times, even though an if statement should avoid that
- -(void) ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
- {
- UITouch *myTouch = [touches anyObject];
- CGPoint location = [myTouch locationInView:[myTouch view]];
- CGPoint convertedLocation = [[CCDirector sharedDirector] convertToGL:location];
- CCSprite* realSprite = [self whichHexagonTouched:convertedLocation];
- NSNumber *hexTag = [NSNumber numberWithInt:realSprite.tag];
- // If the hexagon is not in the array and not nil, it should destroy it and add it to the array
- if(realSprite != nil && ![hexTags containsObject:hexTag]){
- [self destroyHexagon:realSprite];
- [hexTags addObject:hexTag];
- NSLog(@"these are the hexTags %@", hexTags);
- }
- }
Add Comment
Please, Sign In to add comment