我的倒计时使用InGameTime
每帧更新的值每秒更新一次。
这在视觉上效果很好,因为我可以将游戏时间四舍五入到最接近的整数。
...但是如何让我的应用在每秒后播放一次哔声?
下面是我的代码:
-(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"];
}