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

44 lines
991 B

function PauseKeyPressed(key)
if key == 'return' then
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)
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()
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
end