In my game, I have two scenes; the menu scene and the game scene. In my game scene, I have a mute button. It works fine during the game, but if I set it to mute, and then I go back to the menu, and then I go back to the game, it is not set to mute anymore. How do I get my game to save the setting on the mute button? Here is the code for my mute button:
local mutebuttonclicked = display.newImage("MuteButtonClicked.png")
localGroup:insert(mutebuttonclicked)
mutebuttonclicked.x = 1000
local mutebutton = display.newImage("MuteButton.png")
localGroup:insert(mutebutton)
mutebutton.x = display.contentWidth-25
soundOn = true
function unmuting(event)
if event.phase == "began" then
soundOn = true
--IF SOUNDON = TRUE, THEN THERE WILL BE SOUND IN THE GAME
--IF SOUNDON = FALSE, THEN THERE WILL NOT BE SOUND IN THE GAME
mutebuttonclicked.x = 1000
mutebutton.x = display.contentWidth - 25
end
end
mutebuttonclicked:addEventListener("touch",unmuting)
function muting(event)
if event.phase == "began" then
soundOn = false
--IF SOUNDON = TRUE, THEN THERE WILL BE SOUND IN THE GAME
--IF SOUNDON = FALSE, THEN THERE WILL NOT BE SOUND IN THE GAME
mutebutton.x = 1000
mutebuttonclicked.x = display.contentWidth - 25
end
end
mutebutton:addEventListener("touch",muting)
Thanks! [import]uid: 38001 topic_id: 11393 reply_id: 311393[/import]