Hi, i have a game (the reason i'm not posting in the game forum is because this is strictly related to timers). I want different timers to go off, more than once. And it seems like only one goes off at a time, here is a codes snippet:
Code:
- (void) blink {
if (score < 6) {
Bblink2 = TRUE;
blink2T = [NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector (blink2) userInfo:nil repeats:YES];
} else if (score > 5 && score < 75) {
[blink2T invalidate];
blink2T = nil;
}
if (score > 74 && score < 81) {
Bblink3 = TRUE;
blink3T = [NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector (blink2) userInfo:nil repeats:YES];
Bblink2 = TRUE;
blink2T = [NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector (blink2) userInfo:nil repeats:YES];
} else if(score > 80 && score < 400) {
[blink3T invalidate];
blink3T = nil;
[blink2T invalidate];
blink2T = nil;
}
if (score > 399 && score < 406) {
Bblink4 = TRUE;
blink4T = [NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector (blink2) userInfo:nil repeats:YES];
Bblink3 = TRUE;
blink3T = [NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector (blink2) userInfo:nil repeats:YES];
Bblink2 = TRUE;
blink2T = [NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector (blink2) userInfo:nil repeats:YES];
} else if(score > 405) {
[blink4T invalidate];
blink4T = nil;
[blink3T invalidate];
blink3T = nil;
[blink2T invalidate];
blink2T = nil;
}
}
My theory is that it is not being called when the score is higher than 5. I can't call it in a timer, because that is stupid. If the reason that this code is not working is because it is not being called enough. I can fix that on my own, i just need a second opinion, before i go changing my code