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/Game/GameKeyPressed.lua

57 lines
1.0 KiB

function GameKeyPressed(key)
5 months ago
if key == "escape" then
2 months ago
if not MUTED then
musicBattle:setVolume(0)
musicPause:setVolume(0.6)
else
musicBattle:setVolume(0)
musicPause:setVolume(0)
end
_G.GAMESTATE = "PAUSE"
2 months ago
--print("STATE CHANEGD: PAUSED!")
_G.PAUSED = true
5 months ago
end
if key == "b" and not _G.PAUSED then
5 months ago
DebugFlag = not DebugFlag
end
if key == "r" and not _G.PAUSED then
2 months ago
RestartGame()
_G.GAMESTATE = "GAME"
5 months ago
love.load()
end
2 months ago
2 months ago
if key == "m" then
2 months ago
_G.MUTED = not _G.MUTED
2 months ago
-- Need to set the battle music to mute
2 months ago
if _G.MUTED then
2 months ago
musicBattle:setVolume(0)
else
musicBattle:setVolume(0.5)
end
end
2 months ago
if DebugFlag and key == "1" then
1 month ago
--UserPlayer1.speed = 50000
--print("player1 speed increased!")
2 months ago
end
1 month ago
2 months ago
if DebugFlag and key == "2" then
_G.CUR_LEVEL = 2
RestartGame()
love.load()
end
2 months ago
if DebugFlag and key == "3" then
_G.CUR_LEVEL = 3
RestartGame()
love.load()
end
1 month ago
if key == "p" then
testP = PowerUp("speed", 300, 300, "assets/powerup.jpeg", 10)
table.insert(PowerUps, testP)
end
5 months ago
end