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

42 lines
876 B

function PauseKeyPressed(key)
2 months ago
if key == "return" then
2 months ago
-- quickly return to the game
2 months ago
musicBattle:setVolume(0.5)
musicPause:setVolume(0)
-- 0 Return to game
-- 1 Quit
if PAUSE_POS == 0 then
-- unpause the game
_G.GAMESTATE = "GAME"
print("STATE CHANEGD: GAME!")
_G.PAUSED = false
musicBattle:setVolume(0.5)
musicPause:setVolume(0)
2 months ago
elseif PAUSE_POS == 1 then
_G.GAMESTATE = "MENU"
print("STATE CHANEGD: MENU!")
_G.PAUSED = false
musicPause:stop()
musicBattle:stop()
elseif PAUSE_POS == 2 then
love.event.quit()
2 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
2 months ago
end