love2d-tank/Game/GameKeyPressed.lua
2024-07-31 20:37:25 +01:00

51 lines
914 B
Lua

function GameKeyPressed(key)
if key == "escape" then
if not MUTED then
musicBattle:setVolume(0)
musicPause:setVolume(0.6)
else
musicBattle:setVolume(0)
musicPause:setVolume(0)
end
_G.GAMESTATE = "PAUSE"
--print("STATE CHANEGD: PAUSED!")
_G.PAUSED = true
end
if key == "b" and not _G.PAUSED then
DebugFlag = not DebugFlag
end
if key == "r" and not _G.PAUSED then
RestartGame()
_G.GAMESTATE = "GAME"
love.load()
end
if key == "m" then
MUTED = not MUTED
-- Need to set the battle music to mute
if MUTED then
musicBattle:setVolume(0)
else
musicBattle:setVolume(0.5)
end
end
if DebugFlag and key == "1" then
UserPlayer1.speed = 50000
print("player1 speed increased!")
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