我正在制作有硬币,电源UPS和死亡声音的游戏。通常的游戏。我的音响工程师告诉我,为了使声音听起来不错,我需要在所有声音之间有300毫秒的延迟,以便它们不会彼此重叠并使声音更响。例如,如果您在300毫秒内拾取了多个硬币,我不想为所有这些硬币播放声音。硬币之间延迟300毫秒,杀死声音和通电
这是我如何玩随机死亡声音。但是,如何添加延迟?
int random = rand() % 4;
switch (random) {
case 0:
CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(enemyDeathSoundName);
break;
case 1:
CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(enemyDeathSoundName2);
break;
case 2:
CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(enemyDeathSoundName3);
break;
case 3:
CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(enemyDeathSoundName4);
break;
default:
break;
}
有没有人有这样的想法?
这可能会帮助:http://stackoverflow.com/questions/14987061/playing-sounds-in-sequence -with-simpleaudioengine – Patrick 2014-09-02 00:44:32
@Patrick我正在使用'cocos2d-x,所以我没有那些'Objective-C'方法可用。 – 2014-09-02 02:36:46