love2d-tank/Game/GameKeyPressed.lua
2024-07-24 15:58:04 +01:00

41 lines
691 B
Lua

function GameKeyPressed(key)
if key == "escape" then
musicBattle:setVolume(0)
musicPause:setVolume(0.6)
_G.GAMESTATE = "PAUSE"
print("STATE CHANEGD: PAUSED!")
_G.PAUSED = true
end
if key == "b" and not _G.PAUSED then
DebugFlag = not DebugFlag
end
--TODO: Better restart
if key == "r" and not _G.PAUSED then
RestartGame()
_G.GAMESTATE = "GAME"
love.load()
end
-- debug map changes!
--[[
if DebugFlag and key == "1" then
_G.CUR_LEVEL = 1
RestartGame()
love.load()
end
if DebugFlag and key == "2" then
_G.CUR_LEVEL = 2
RestartGame()
love.load()
end
if DebugFlag and key == "3" then
_G.CUR_LEVEL = 3
RestartGame()
love.load()
end
--]]
end