- Cocos2d-x Game Development Blueprints
- Karan Sequeira
- 100字
- 2021-07-16 13:47:57
Let's make some HTML5 noise
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);
推薦閱讀
- Practical Data Analysis Cookbook
- Spring Cloud Alibaba微服務架構設計與開發實戰
- .NET 4.0面向對象編程漫談:基礎篇
- INSTANT Weka How-to
- Kotlin Standard Library Cookbook
- 精通Python設計模式(第2版)
- TradeStation交易應用實踐:量化方法構建贏家策略(原書第2版)
- Java程序設計:原理與范例
- Elasticsearch Server(Third Edition)
- Python數據結構與算法(視頻教學版)
- Java實戰(第2版)
- Orchestrating Docker
- Java Web應用開發項目教程
- Greenplum構建實時數據倉庫實踐
- AI自動化測試:技術原理、平臺搭建與工程實踐