My game plays a ticking clock sound every second. I would like the sound to slowly speed up throughout the game. My initial thought was to use an NSTimer and update the speed when the method fires, like this:
static float soundDelay = 1.0;
timer = [NSTimer scheduledTimerWithTimeInterval:clickClackDelay
target:self
selector:@selector(playSound)
userInfo:nil
repeats:YES];
- (void)playSound {
soundDelay -= 0.1;
NSLog(@"Play sound");
}
This didn’t work, and it seems like NSTimer isn’t really meant to be used that way. Any other suggestions on how I could accomplish this?
You can implement it by calling the
playSoundmethod from itself.You can do it in the following way.