Unlike our first game, we do have a few sounds for our dragon's story. HTML5 audio is still quite primitive on mobile browsers, but it is satisfactory on desktop browsers and it is a developing specification.
For the purpose of our game, we need only two effects: one for the flapping of dragon's wings and another when he crashes into a tower. You've already seen how to play these effects. These sounds must be listed in the resources.js
file and must also be preloaded. We preload them in mainmenu.js
with the following commands:
cc.AudioEngine.getInstance().preloadEffect(s_Flap_mp3); cc.AudioEngine.getInstance().preloadEffect(s_Crash_mp3);
18.223.170.63