aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFallstar <fallstar@live.fr>2014-05-23 19:19:18 +0000
committerFallstar <fallstar@live.fr>2014-05-23 19:19:18 +0000
commit9182ae1642a750fd5a8a574a6bbd1a36c105d9d9 (patch)
treec952d11ccf31011785b2bc9b1ff41ddafbf3c5ab
parent12ba7de4216a435acd7958820588c27e76b150e4 (diff)
downloadMastermind-9182ae1642a750fd5a8a574a6bbd1a36c105d9d9.tar.gz
Mastermind-9182ae1642a750fd5a8a574a6bbd1a36c105d9d9.tar.bz2
Mastermind-9182ae1642a750fd5a8a574a6bbd1a36c105d9d9.tar.xz
Mastermind-9182ae1642a750fd5a8a574a6bbd1a36c105d9d9.zip
Music on menu + Mute button in Options.
-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
-rw-r--r--TODO.odtbin55329 -> 0 bytes
-rw-r--r--main.lua2
6 files changed, 30 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
diff --git a/TODO.odt b/TODO.odt
deleted file mode 100644
index 8d2a101..0000000
--- a/TODO.odt
+++ /dev/null
Binary files differ
diff --git a/main.lua b/main.lua
index b34509a..d94238b 100644
--- a/main.lua
+++ b/main.lua
@@ -8,6 +8,8 @@ require 'love2d-fakecanvas/fakecanvas' -- Load canvas emulation library
Debug = false -- Set to true to view the answer in Solo mode
+Mute = false
+
Screen = {} -- Contains window width and height
Fonts = {} -- Used to store preloaded fonts