diff options
Diffstat (limited to 'Gamestates')
-rw-r--r-- | Gamestates/About.lua | 3 | ||||
-rw-r--r-- | Gamestates/Config.lua | 17 | ||||
-rw-r--r-- | Gamestates/Menu.lua | 2 | ||||
-rw-r--r-- | Gamestates/Multiplayer/InGame.lua | 2 | ||||
-rw-r--r-- | Gamestates/Solo.lua | 2 |
5 files changed, 18 insertions, 8 deletions
diff --git a/Gamestates/About.lua b/Gamestates/About.lua index d65b245..3f267a7 100644 --- a/Gamestates/About.lua +++ b/Gamestates/About.lua @@ -26,5 +26,8 @@ function About:draw() Gui.core.draw() end +function About:leave() + Menu.Music:stop() +end return About diff --git a/Gamestates/Config.lua b/Gamestates/Config.lua index a64650e..c8c8fbe 100644 --- a/Gamestates/Config.lua +++ b/Gamestates/Config.lua @@ -27,6 +27,9 @@ function Config:loadUserConfig() -- Load user config file if not Config.player_name.text then Config.player_name.text = "BlueMind" -- Set default player_name if nothing was found in the user config file end + if not Config.Mute then + Config.Mute = false + end end function Config:enter() @@ -42,12 +45,14 @@ function Config:update(dt) if Gui.Button{text = "Save", size = {Utils.percentCoordinates(60, 10)}} then love.filesystem.write( "userConfig", "PLAYERNAME: " .. Config.player_name.text) -- Write the new name to the config file end - if Gui.Button{text = "Mute", size = {Utils.percentCoordinates(40, 10)}} then - if Mute == false then - Mute = true + if Config.Mute == false then + if Gui.Button{text = "Mute", size = {Utils.percentCoordinates(40, 10)}} then + Config.Mute = true Menu.Music:stop() - else - Mute = false + end + else + if Gui.Button{text = "Unmute", size = {Utils.percentCoordinates(40, 10)}} then + Config.Mute = false Menu.Music:play() end end @@ -56,6 +61,7 @@ end + -- Quickie's functions function Config:draw() Gui.core.draw() @@ -72,6 +78,7 @@ end function Config:leave() love.keyboard.setTextInput(false) + Menu.Music:stop() end return Config diff --git a/Gamestates/Menu.lua b/Gamestates/Menu.lua index 7a7b32c..cf05d16 100644 --- a/Gamestates/Menu.lua +++ b/Gamestates/Menu.lua @@ -48,7 +48,7 @@ function Menu:enter() -- End Menu.Music = love.audio.newSource("Resources/BlueMind.ogg") Menu.Music:setLooping(true) - if Mute == false then + if Config.Mute == false then Menu.Music:play() end end diff --git a/Gamestates/Multiplayer/InGame.lua b/Gamestates/Multiplayer/InGame.lua index 20bf6c4..ba47505 100644 --- a/Gamestates/Multiplayer/InGame.lua +++ b/Gamestates/Multiplayer/InGame.lua @@ -36,7 +36,7 @@ function InGame:enter(Local) -- Initialize or reset variables when entering game InGame.Musiclowlife = love.audio.newSource("Resources/BlueMind midlife.ogg") InGame.Music = Menu.Music InGame.Music:setLooping(true) - if Mute == false then + if Config.Mute == false then InGame.Music:rewind() end end diff --git a/Gamestates/Solo.lua b/Gamestates/Solo.lua index 3e19152..2a73f1f 100644 --- a/Gamestates/Solo.lua +++ b/Gamestates/Solo.lua @@ -28,7 +28,7 @@ function Solo:enter() -- Initialize or reset variables when entering game Solo.Music = Menu.Music Solo.Music:setLooping(true) - if Mute == false then + if Config.Mute == false then Solo.Music:rewind() end end |