I have 5 pages, they are controlled by scenecontroller.
Scenecontroller simply has 3 buttons: go back a page, go forward a page, and a toggle-button for music on/off which works fine for background music on all pages.
self.music:addEventListener("click", self.musicToggle, self)
function sceneController:musicToggle()
if isMusicOn then
isMusicOn = false
bgmusic:stop()
else
isMusicOn = true
bgmusic = bgtune:play(0, true)
end
end
When I'm in a page, I also have other events that will play other sound-effects. I want to have these sounds off or on depending on my musicToggle. I can't use "if isMusicOn" since that is declared in Scenecontroller.
What can I do? I hope I'm making sense.
Thanks
Comments
https://github.com/ar2rsawseen/GameTemplate/blob/master/classes/Sounds.lua
Usage is like this:
you can add a playNext function that will play the next random/queued sound.
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
So I don't put any sound control in scenecontroller? and move the music toggle to main?