What I have
I have two rooms: rm_home
and rm_options
. I have a sound: snd_Bgm
. And, I have three objects: obj_bgm
, obj_BtnOnClicked
, and obj_BtnOffClicked
.
What I want is very simple
Player can turn on/off the snd_Bgm
.
What I have done
In obj_bgm
, I have these events:
Create Event: set var
global.sound to 1
Room Start: stop sound
snd_Bgm
; ifglobal.sound == 1
then play soundsnd_Bgm
In obj_BtnOnClicked
, I have these events:
Left-Pressed Event: play sound
snd_Bgm
; set varglobal.sound to 1
In obj_BtnOffClicked
, I have these events:
Left-Pressed Event: stop sound
snd_Bgm
; set varglobal.sound to 0
I put obj_BtnOnClicked
, and obj_BtnOffClicked
in rm_options
, which can be accessed from rm_home
. Then, I put obj_bgm
in rm_home
.
This is the problem
When game start, it will show rm_home
and plays the snd_bgm
. I go to rm_options
, then click the obj_BtnOffClicked
to turn off the sound, so the sound is off. But, when I go back to rm_home
, the sound is on again.
What I think
I shouldn't put Create Event: set var global.sound to 1
in obj_bgm
, because when rm_home
start, it takes the value of var global.sound
from Create Event. But, if I put Create Event in obj_BtnOnClicked
or obj_BtnOffClicked
, it shows a Get Error.
What should I do? Please explain your answer. Thanks.