我刚刚开始使用Phaser制作一个简单的平台游戏,这是我的新手。
我设法播放音乐,但无法播放,Google也没有帮助。
这是我正在使用的音频代码,有什么建议吗?
game.load.audio('hotttt', ['assets/audio/hotttt.mp3', 'assets/audio/hotttt.ogg']); music = game.add.audio('hotttt'); music.play();
小智.. 5
首先,您像加载音频文件一样,然后为音频本身创建实例。
例:
game.load.audio('background_music', ['assets/sounds/background_music.mp3', 'assets/sounds/background_music.wav']); backgroundMusic = game.add.audio('background_music'); backgroundMusic.loop = true; // This is what you are lookig for backgroundMusic.play();
希望能帮助到你!
首先,您像加载音频文件一样,然后为音频本身创建实例。
例:
game.load.audio('background_music', ['assets/sounds/background_music.mp3', 'assets/sounds/background_music.wav']); backgroundMusic = game.add.audio('background_music'); backgroundMusic.loop = true; // This is what you are lookig for backgroundMusic.play();
希望能帮助到你!