A2020 Posted April 14, 2017 Report Share Posted April 14, 2017 So, I'm having problems figuring this out. I was able to control audio volume for audios that I load once the game itself is running, but I don't know how to do it for audios that I load on the preload stage. For the ones I have working I do something like this, where "audio" is a global variable. audio = new Audio('assets/ogg/nagg/audio.ogg'); audio.play(); audio.volume = overallVolume; And a function triggered by buttons with stuff like: audio.volume += 0.1; overallVolume = audio.volume; Now for the audios I "preload" I play them this way, and don't know how would I tweak its volume (preload) game.load.audio('wheel', ['assets/ogg/wheel.ogg']); and to play the sound: game.sound.play('wheel', 0.4); So question is, how should I play the preload audios to be able to control the volumes on them? Quote Link to comment Share on other sites More sharing options...
A2020 Posted April 14, 2017 Author Report Share Posted April 14, 2017 I feel silly, sometimes when you end the post you realize the answer is right in front, I did sound=game.sound.play('wheel', 0.4); And then changed the sound volume as I was doing with audio. Leave it here in case someone has similar problems Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.