Um, when you press the shoot button, you obviously call something like:
// -------------------------------------- // PSEUDO-CODE // -------------------------------------- -(void)shootButtonPressed { [self checkEnemies]; }
From this, why don't you just declare a BOOL variable and use it to check if all fingers are pressed:
// -------------------------------------- // PSEUDO-CODE // -------------------------------------- @interface MyGameClass { // defaults to FALSE BOOL isTouching; } -(void)shootButtonPressed { // assumes isTouching is a instance variable declared somewhere isTouching = YES; [self checkEnemies]; } -(void)checkEnemies { // check enemy action // --------------------------------------------- // when finger lifts off the screen, this // isTouching variable will be reset to FALSE // so as long as isTouching is TRUE, we call // this same method checkEnemies again // --------------------------------------------- if(isTouching) { [self checkEnemies]; } } // reset the isTouching variable when user finger is taken off the screen -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { isTouching = NO; }
source share