1// objc with cocos2d-iphone
2[[SimpleAudioEngine sharedEngine] playBackgroundMusic:
3@"background-music-aac.caf"];
接着在
ccTouchesEnded()方法中播放发射子弹的音效
1// cpp with cocos2d-x
2CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(
3"pew-pew-lei.wav");
1// objc with cocos2d-iphone
2[[SimpleAudioEngine sharedEngine] playEffect:@"pew-pew-lei.caf"];
好了,音效和背景音乐就这样搞定了。