Hi,
I’m new here and my knowledge of Gdevelop is basic so apologies if my question so apologies if my event sheet makes no sense!
- What i’m trying to do
I’ve created an Audio menu scene that you can access from teh main menu.
I’ve used two toggle switches on this page called:
- “Background_music”
- “All_sound”
Background music turns off just the background music on my game scene.
The All sound toggle turns off all music / sounds in the game scene. It does this by changing the global variable Game vol down to 0 when All_sound is unchecked.
Both button are working in this regard.
- What’s not working
What I’m struggling to do is to get the toggle buttons to save so that when I exit the Audio menu scene and then return they are in the state they were in when I left.
So in other words, if I enter the audio settings scene and click the “Background_music” checkbox it moves the checkbox to its unchecked state. If I then go to the gameplay the voiceover and sound effects play but not the background music. This is how I intended so all good. However, if I exit the game and go back to the audio menu then the checkbox is in its checked state (not unchecked state as I left it). If I don’t touch either checkbox, exit and go to the game (so the checkbox is in its checked state) then the background music plays again. I would like the checkbox to be in the state that I left it when I return.
- What I’ve tried
I have 2 global variables:
- Gamvol
2)Background_Music_Toggled
I also have 2 scene audio variables
- tempMusicEnabled
- tempAllsound
I’ve tried to get it so that if Background_music is checked then the Background_Music_Toggled global variable is set to 0 and if Background_music is unchecked global variable is set to 1. I’ve tried to save these global variables.
On the game event sheet there’s a condition that says if Background_Music_Toggled global variable is set to 0 then play the sound XXX on the channel 10. There’s another condition that says f Background_Music_Toggled global variable is set to 1 then stop the music of channel 10.
I’ve then tried to load the global variables at the beginning of the scene.
I’ve done the same for the All_sound button.
I’ve attached a screenshot of my event sheet for the audio menu scene.
Sorry if it’s a bit muddled, I’ve made myself quite confused with this!