You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
love2d-tank/Pause/PauseKeyPressed.lua

52 lines
1.0 KiB

function PauseKeyPressed(key)
4 months ago
if key == "return" then
4 months ago
-- quickly return to the game
3 months ago
if not MUTED then
musicBattle:setVolume(0.5)
musicPause:setVolume(0)
else
musicBattle:setVolume(0)
musicPause:setVolume(0)
end
4 months ago
-- 0 Return to game
-- 1 Quit
if PAUSE_POS == 0 then
-- unpause the game
_G.GAMESTATE = "GAME"
3 months ago
--print("STATE CHANEGD: GAME!")
4 months ago
_G.PAUSED = false
3 months ago
if not MUTED then
musicBattle:setVolume(0.5)
musicPause:setVolume(0)
else
musicBattle:setVolume(0)
musicPause:setVolume(0)
end
4 months ago
elseif PAUSE_POS == 1 then
_G.GAMESTATE = "MENU"
3 months ago
--print("STATE CHANEGD: MENU!")
4 months ago
_G.PAUSED = false
musicPause:stop()
musicBattle:stop()
elseif PAUSE_POS == 2 then
love.event.quit()
4 months ago
end
end
if love.keyboard.isDown("up") then
if _G.PAUSE_POS == 0 then
_G.PAUSE_POS = 0
else
_G.PAUSE_POS = _G.PAUSE_POS - 1
end
end
if love.keyboard.isDown("down") then
if _G.PAUSE_POS >= _G.PAUSE_MAX then
_G.PAUSE_POS = _G.PAUSE_MAX
else
_G.PAUSE_POS = _G.PAUSE_POS + 1
end
end
4 months ago
end