sonic-bluestreak/sonic-bluestreak.love/scenes/menus/mainmenu/menu.lua

49 lines
1.8 KiB
Lua
Raw Permalink Normal View History

2021-11-25 10:57:13 +01:00
local Parent = require "game.modules.gui.fancymenu"
local MainMenu = Parent:extend()
local defTransitions = require "birb.modules.transitions"
local radTransitions = require "game.modules.transitions"
local MENU_X, MENU_Y = 24, 48
local MENU_W = 424/3
local MENU_ITEM_NUMBER = 8
function MainMenu:new()
MainMenu.super.new(self, "mainmenu", MENU_X, MENU_Y, MENU_W, MENU_ITEM_NUMBER, false)
self:addItem("Launch game", "left", function() self:launchGame() end)
self:addItem("Options", "left", function() self:launchOptions() end)
self:addItem("Battle Level", "left", function() self:battle() end)
self:addItem("Shadow Shoot Level", "left", function() self:shadowShot() end)
self:addItem("Return to title", "left", function() self:returnToTitle() end, "back")
self:setCancelWidget()
self:addItem("Exit game", "left", function() self:exitGame() end)
self:getFocus()
end
function MainMenu:launchGame()
core.screen:startTransition(defTransitions.circle, defTransitions.default, function() scenes.overworld() end, 424/2, 240/2)
core.scenemanager.currentScene:hideOverlay()
end
function MainMenu:launchOptions()
core.screen:startTransition(defTransitions.default, defTransitions.default, function() scenes.menus.options() end, 424/2, 240/2)
end
function MainMenu:returnToTitle()
core.screen:startTransition(defTransitions.circle, radTransitions.borders, function() scenes.menus.title(true) end, 424/2, 240/2)
end
function MainMenu:battle()
core.screen:startTransition(defTransitions.default, defTransitions.default, function() scenes.test("ebeach") end, 424/2, 240/2)
end
function MainMenu:shadowShot()
core.screen:startTransition(defTransitions.circle, radTransitions.borders, function() scenes.test2() end, 424/2, 240/2)
end
function MainMenu:exitGame()
love.event.quit("000")
end
return MainMenu