aboutsummaryrefslogtreecommitdiffstats
path: root/Gamestates
diff options
context:
space:
mode:
Diffstat (limited to 'Gamestates')
-rw-r--r--Gamestates/Config.lua13
-rw-r--r--Gamestates/Menu.lua7
-rw-r--r--Gamestates/Multiplayer/InGame.lua6
-rw-r--r--Gamestates/Solo.lua6
4 files changed, 28 insertions, 4 deletions
diff --git a/Gamestates/Config.lua b/Gamestates/Config.lua
index 394b115..a64650e 100644
--- a/Gamestates/Config.lua
+++ b/Gamestates/Config.lua
@@ -33,6 +33,8 @@ function Config:enter()
Previous = "Gamestates/Menu"
end
+
+
function Config:update(dt)
Gui.group.push{grow = "down", pos = {Utils.percentCoordinates(20, 20)}}
Gui.Label{text = "Player name", size = {Utils.percentCoordinates(10, 10)}}
@@ -40,9 +42,20 @@ 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
+ Menu.Music:stop()
+ else
+ Mute = false
+ Menu.Music:play()
+ end
+ end
Gui.group.pop{}
end
+
+
-- Quickie's functions
function Config:draw()
Gui.core.draw()
diff --git a/Gamestates/Menu.lua b/Gamestates/Menu.lua
index 37e69a4..7a7b32c 100644
--- a/Gamestates/Menu.lua
+++ b/Gamestates/Menu.lua
@@ -46,6 +46,11 @@ function Menu:enter()
Gui.core.style.color.active.bg[2] = 24
Gui.core.style.color.active.bg[3] = 24
-- End
+ Menu.Music = love.audio.newSource("Resources/BlueMind.ogg")
+ Menu.Music:setLooping(true)
+ if Mute == false then
+ Menu.Music:play()
+ end
end
function Menu:update(dt)
@@ -62,4 +67,6 @@ function Menu:draw()
Gui.core.draw()
end
+
+
return Menu
diff --git a/Gamestates/Multiplayer/InGame.lua b/Gamestates/Multiplayer/InGame.lua
index f94be12..20bf6c4 100644
--- a/Gamestates/Multiplayer/InGame.lua
+++ b/Gamestates/Multiplayer/InGame.lua
@@ -34,9 +34,11 @@ function InGame:enter(Local) -- Initialize or reset variables when entering game
InGame:resize() -- Call the function filling the canvas
InGame.Musiclowlife = love.audio.newSource("Resources/BlueMind midlife.ogg")
- InGame.Music = love.audio.newSource("Resources/BlueMind.ogg")
+ InGame.Music = Menu.Music
InGame.Music:setLooping(true)
- InGame.Music:play()
+ if Mute == false then
+ InGame.Music:rewind()
+ end
end
function InGame:resize() -- Called in :enter() and when the window is resized
diff --git a/Gamestates/Solo.lua b/Gamestates/Solo.lua
index 7cd85da..3e19152 100644
--- a/Gamestates/Solo.lua
+++ b/Gamestates/Solo.lua
@@ -26,9 +26,11 @@ function Solo:enter() -- Initialize or reset variables when entering game
Solo:resize() -- Call the function filling the canvas
- Solo.Music = love.audio.newSource("Resources/BlueMind.ogg")
+ Solo.Music = Menu.Music
Solo.Music:setLooping(true)
- Solo.Music:play()
+ if Mute == false then
+ Solo.Music:rewind()
+ end
end
function Solo:resize() -- Called in :enter() and when the window is resized