summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-07-16 17:20:03 +0200
committerAki <nthirtyone@gmail.com>2017-07-16 17:20:03 +0200
commit73bca2d56b9a95b6b233da8ac466ba1d1f081c76 (patch)
tree34221b07f3690829b32e9068d2c31068c69716cd
parent1aa2ddfd920899e61295d876f3433dcab6dd6ed8 (diff)
downloadroflnauts-73bca2d56b9a95b6b233da8ac466ba1d1f081c76.zip
roflnauts-73bca2d56b9a95b6b233da8ac466ba1d1f081c76.tar.gz
roflnauts-73bca2d56b9a95b6b233da8ac466ba1d1f081c76.tar.bz2
Pause works now
MusicPlayer bug still exists for pause and win screens
-rw-r--r--config/menus/pause.lua24
-rw-r--r--not/World.lua5
2 files changed, 25 insertions, 4 deletions
diff --git a/config/menus/pause.lua b/config/menus/pause.lua
index 74dd043..60aa2fc 100644
--- a/config/menus/pause.lua
+++ b/config/menus/pause.lua
@@ -1,19 +1,35 @@
local menu = ...
local Button = require "not.Button"
+local Element = require "not.Element"
local width, height = love.graphics.getWidth()/getScale(), love.graphics.getHeight()/getScale()
local bx = width/2-29
return {
+ Element(menu)
+ :set("draw", function (self, scale)
+ love.graphics.setColor(0, 0, 0, 110)
+ local width, height = love.graphics.getWidth(), love.graphics.getHeight()
+ love.graphics.rectangle("fill", 0, 0, width, height)
+ end)
+ ,
Button(menu)
:setText("Unpause")
- :setPosition(bx, height - 36)
- :set("active", function () end)
+ :setPosition(bx, height - 38)
+ :set("active", function (self)
+ sceneManager:removeTopScene()
+ local scene = sceneManager:getAllScenes()[1]
+ scene:setSleeping(false)
+ scene:setInputDisabled(false)
+ end)
,
Button(menu)
:setText("Exit")
- :setPosition(bx, height - 20)
- :set("active", function () end)
+ :setPosition(bx, height - 22)
+ :set("active", function (self)
+ sceneManager:removeTopScene()
+ sceneManager:changeScene(Menu("main"))
+ end)
,
}
diff --git a/not/World.lua b/not/World.lua
index 29c46cc..c6b74a3 100644
--- a/not/World.lua
+++ b/not/World.lua
@@ -371,6 +371,11 @@ function World:controlpressed (set, action, key)
local new = World(map, nauts)
sceneManager:changeScene(new)
end
+ if key == "escape" then
+ sceneManager:addScene(Menu("pause"))
+ self:setInputDisabled(true)
+ self:setSleeping(true)
+ end
for k,naut in pairs(self:getNautsAll()) do
naut:controlpressed(set, action, key)
end