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/Menu/MenuKeyPressed.lua

54 lines
972 B

function MenuKeyPressed(key)
if key == "return" then
-- 0 Start Game
-- 1 ??
-- 2 ???
-- 3 Quit
if MENU_POS == 0 then
--Change state to GAME!
_G.GAMESTATE = "GAME"
--print("STATE CHANEGD: GAME!")
musicMenu:stop()
elseif MENU_POS == 1 then
--print("STATE CHANEGD: DUNNO!")
elseif MENU_POS == 2 then
--print("STATE CHANEGD: DUNNO!")
elseif MENU_POS == 3 then
love.event.quit()
end
end
if love.keyboard.isDown("up") then
if _G.MENU_POS == 0 then
_G.MENU_POS = 0
else
_G.MENU_POS = _G.MENU_POS - 1
end
end
if love.keyboard.isDown("down") then
if _G.MENU_POS >= _G.MENU_MAX then
_G.MENU_POS = _G.MENU_MAX
else
_G.MENU_POS = _G.MENU_POS + 1
end
end
if key == "r" then
musicBattle:stop()
musicMenu:stop()
musicPause:stop()
_G.GAMESTATE = "MENU"
love.load()
end
if key == "m" then
MUTED = not MUTED
if MUTED then
musicMenu:setVolume(0)
else
musicMenu:setVolume(0.5)
end
end
end