I made a button to turn off and on the sound in my game, but when I press the button to turn off the music the picture changed to the speaker with no sound. But if I am turning off the music and move into another room, the music is still off but the image of the button becomes the image of a speaker with sound. If anyone knows how to help please help me! Thank you very much ! (I use google translate so please forgive me if there is any confusion)
Here is the code in button sound on - off :
- Event create:
image_speed = 0;
global.music = 1;
- Event left release:
if global.music = 1 {
audio_pause_sound(sou_background)
sprite_index = s_sou_off;
sprite = false
}
if global.music = 0 {
audio_resume_sound(sou_background)
sprite_index = s_sou_on;
sprite = true
}
global. music = !global.music
Here is the code in button sound on - off :
- Event create:
image_speed = 0;
global.music = 1;
- Event left release:
if global.music = 1 {
audio_pause_sound(sou_background)
sprite_index = s_sou_off;
sprite = false
}
if global.music = 0 {
audio_resume_sound(sou_background)
sprite_index = s_sou_on;
sprite = true
}
global. music = !global.music
Attachments
-
17 KB Views: 6
-
122 KB Views: 9
-
20.9 KB Views: 9
Last edited: