我正在使用 Cocos2d-x 库和 Cocosdenshion AudioEngine 开发一个简单的视频游戏。
我可以使用 SharedAudioEngine 的 playEffect 方法播放单个声音,但我想做的是按顺序播放多个声音。
但我不知道从哪里开始。我尝试创建一个 Action 序列,它将使用选择器调用方法,但它似乎不起作用。
最佳答案
write number of Function equal to the Number of Sound effects.
like this
Function1(){
CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("Sound1.mp3");
}
Function2{
CocosDenshion::SimpleAudioEngine::sharedEngine()->stopAllEffects();
CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("Sound2.mp3");
}
Function3{
CocosDenshion::SimpleAudioEngine::sharedEngine()->stopAllEffects();
CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("Sound3.mp3");
}
CCSequence *seq = CCSequence::create(Func1,func2,func3,NULL);
CCRepeatForever *repeat = CCRepeatForever::create(seq);
this->runAction(repeat);
关于c++ - 使用 CocosDenshion 按顺序播放声音?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12509404/