My countdown gets updated every second using my InGameTime value that is updated every frame.
This works great visually because I can just round the game time to the nearest int.
…But how do I get my app to play a beep after each second?
Below is my code:
-(void) setTimer:(ccTime) delta{
int timeInSeconds = (int)appDelegate.InGameTime;//Game time E.G: 8.2332432
/*
Stuff is here to display the tempTime
*/
//The below effect plays the sound every frame,
//is there an equation that I can apply to appDelegate.InGameTime
//that will play it once a second?
[[SimpleAudioEngine sharedEngine] playEffect:@"tick.mp3"];
}
1 Answer