在cocos2d中按顺序播放声音

Fai*_*lik 1 iphone cocos2d-iphone xcode4.2 simpleaudioengine

如何按顺序在cocos2d中播放声音,任何身体都有任何想法,例如我有三个声音

[[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.OrderOneSound]];

[[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.WithSound]];

[[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.OrderTwoSound]];
Run Code Online (Sandbox Code Playgroud)

这是声音效果播放的代码,当一个人停下来然后再播放之后我怎么玩

小智 9

CCSequence* sequence = [CCSequence actions: 
                                [CCCallBlock actionWithBlock:^(void)
                                 { 
                                     [[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.OrderOneSound]];
                                 }],
                                [CCDelayTime actionWithDuration:3],
                                [CCCallBlock actionWithBlock:^(void)
                                 { 
                                     [[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.WithSound]];
                                 }],
                                [CCDelayTime actionWithDuration:3],
                                [CCCallBlock actionWithBlock:^(void)
                                 { 
                                     [[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.OrderTwoSound]];
                                 }],
                                nil];
[self runAction:sequence];
Run Code Online (Sandbox Code Playgroud)

这种方式可以解决您的问题,但唯一的缺点是您必须自己插入延迟时间.希望它适合你的情况.