It is the first time I'm messing around with sound, and I'm having a hard time trying to decide how to proceed with the ON/OFF sound toggle in the options menu.
You guys have any ideas? What's the best way to proceed with this?
(my main concerns are ease of use for the developer X game performance)
1- Using a sub-event to test a global variable (isSoundOn) whenever I have to play a sound in the game.
The problem with this one is having to add a sub event everytime I want to play a sound.
2- Use a global variable to keep the sound volume (volumeLevel) that I can set to zero when the player clicks on the sound toggle.
This is way more easy. My question here is: Will the sound be played even if there's no volume? Is it intensive enough for me to worry about it?
I know it's not a big deal but I'm trying to understand how audio works in HTML5
Thanks in advance!