September 2014
Beginner
266 pages
5h 38m
English
Next, we will add the sound effects for the game, but as with the background music, we have to preload the files in advance. So right under where we played the background music in applicationDidFinishLaunching, add the following code to preload files for six sound effects:
CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadEffect("enemyKill.wav"); CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadEffect("fireRocket.wav"); CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadEffect("gunshot.wav"); CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadEffect("playerKill.wav"); CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadEffect("pop.wav"); CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadEffect("rocketExplode.wav"); ...Read now
Unlock full access