-- Added loading of .vsmf map files -- Updated some variable names -- Added developer information to the top left of the screen -- Added a trial inventory
132 lines
No EOL
5.8 KiB
Lua
132 lines
No EOL
5.8 KiB
Lua
menu = {
|
|
subScene = "intro"
|
|
}
|
|
menuButtons = {
|
|
Start = {},
|
|
Settings = {},
|
|
Quit = {}
|
|
}
|
|
font_ini = require('scripts/fonts')
|
|
world_ini = require('world')
|
|
function menu.load()
|
|
RGB = 1
|
|
RGB_hover = 0.5
|
|
titleCard = {
|
|
duration = false,
|
|
mainTitle = {
|
|
intro_text = love.graphics.newText(Effexor_Intro, "Void Shot"),
|
|
main_text = love.graphics.newText(Effexor_menu, "Void Shot"),
|
|
y = 250,
|
|
fallingRate = 2
|
|
},
|
|
secondTitle = {
|
|
intro_text = love.graphics.newText(ScratchedCarPaint_Intro, "Endless Desert"),
|
|
main_text = love.graphics.newText(ScratchedCarPaint_menu, "Endless Desert"),
|
|
y = 500,
|
|
fallingRate = 2
|
|
},
|
|
targetTime = 1,
|
|
elapsedTime = 0
|
|
}
|
|
menuButtons = {
|
|
Start = {
|
|
x = window.x/2 - 100,
|
|
y = window.y / 2 - 200,
|
|
width = 200,
|
|
height = 75,
|
|
text = love.graphics.newText(Effexor_buttons, "Enter")
|
|
},
|
|
Settings = {
|
|
x = window.x/2 - 100,
|
|
y = window.y / 2,
|
|
width = 200,
|
|
height = 75,
|
|
text = love.graphics.newText(Effexor_buttons, "Settings")
|
|
},
|
|
Quit = {
|
|
x = window.x/2 - 100,
|
|
y = window.y / 2 + 200,
|
|
width = 200,
|
|
height = 75,
|
|
text = love.graphics.newText(Effexor_buttons, "Abandon")
|
|
}
|
|
}
|
|
end
|
|
|
|
function menu.update(dt)
|
|
if titleCard.duration == true then
|
|
titleCardUpdate(dt)
|
|
if titleCard.elapsedTime >= titleCard.targetTime then
|
|
menu.subScene = "main"
|
|
RGB = 1
|
|
titleCard.mainTitle.y = 0
|
|
titleCard.secondTitle.y = 100
|
|
titleCard.duration = false
|
|
titleCard.elapsedTime = 0
|
|
titleCard.targetTime = 1
|
|
end
|
|
end
|
|
if menu.subScene == "main" and love.mouse.isDown(1) then
|
|
if mouseOver(menuButtons.Start) then menu.subScene = "end" end
|
|
if mouseOver(menuButtons.Settings) then menu.subScene = "settings" end
|
|
if mouseOver(menuButtons.Quit) then menu.subScene = "exit" end
|
|
end
|
|
if menu.subScene == "end" then
|
|
if titleCard.elapsedTime < titleCard.targetTime then
|
|
titleCard.elapsedTime = titleCard.elapsedTime + love.timer.getDelta()
|
|
else
|
|
Scene = "gameTest"
|
|
end
|
|
end
|
|
end
|
|
|
|
function menu.draw()
|
|
love.graphics.print(menu.subScene, 100, 200)
|
|
if menu.subScene == "intro" then
|
|
love.graphics.setColor(RGB, RGB, RGB)
|
|
love.graphics.draw(titleCard.mainTitle.intro_text, window.x/2 - titleCard.mainTitle.intro_text:getDimensions()/2, titleCard.mainTitle.y)
|
|
love.graphics.draw(titleCard.secondTitle.intro_text, window.x/2 - titleCard.secondTitle.intro_text:getDimensions()*0.5/2, titleCard.secondTitle.y, 0, 0.5, 0.65)
|
|
elseif menu.subScene == "main" then
|
|
love.graphics.setColor(RGB, RGB, RGB)
|
|
love.graphics.draw(titleCard.mainTitle.main_text, window.x/2 - titleCard.mainTitle.main_text:getDimensions()/2, titleCard.mainTitle.y)
|
|
love.graphics.draw(titleCard.secondTitle.main_text, window.x/2 - titleCard.secondTitle.main_text:getDimensions()*0.5/2, titleCard.secondTitle.y, 0, 0.5, 0.65)
|
|
|
|
-- buttons
|
|
if mouseOver(menuButtons.Start) then love.graphics.setColor(RGB_hover, RGB_hover, RGB_hover) else love.graphics.setColor(RGB, RGB, RGB) end
|
|
love.graphics.draw(menuButtons.Start.text, menuButtons.Start.x, menuButtons.Start.y)
|
|
love.graphics.rectangle("line", menuButtons.Start.x, menuButtons.Start.y, menuButtons.Start.width, menuButtons.Start.height)
|
|
|
|
if mouseOver(menuButtons.Settings) then love.graphics.setColor(RGB_hover, RGB_hover, RGB_hover) else love.graphics.setColor(RGB, RGB, RGB) end
|
|
love.graphics.draw(menuButtons.Settings.text, menuButtons.Settings.x, menuButtons.Settings.y)
|
|
love.graphics.rectangle("line", menuButtons.Settings.x, menuButtons.Settings.y, menuButtons.Settings.width, menuButtons.Settings.height)
|
|
|
|
if mouseOver(menuButtons.Quit) then love.graphics.setColor(RGB_hover, RGB_hover, RGB_hover) else love.graphics.setColor(RGB, RGB, RGB) end
|
|
love.graphics.draw(menuButtons.Quit.text, menuButtons.Quit.x, menuButtons.Quit.y)
|
|
love.graphics.rectangle("line", menuButtons.Quit.x, menuButtons.Quit.y, menuButtons.Quit.width, menuButtons.Quit.height)
|
|
love.graphics.setColor(RGB, RGB, RGB)
|
|
elseif menu.subScene == "end" then
|
|
love.graphics.setColor(1,0,0)
|
|
|
|
love.graphics.draw(titleCard.mainTitle.main_text, window.x/2 - titleCard.mainTitle.main_text:getDimensions()/2, titleCard.mainTitle.y)
|
|
love.graphics.draw(titleCard.secondTitle.main_text, window.x/2 - titleCard.secondTitle.main_text:getDimensions()*0.5/2, titleCard.secondTitle.y, 0, 0.5, 0.65)
|
|
|
|
love.graphics.draw(menuButtons.Start.text, menuButtons.Start.x, menuButtons.Start.y)
|
|
love.graphics.rectangle("line", menuButtons.Start.x, menuButtons.Start.y, menuButtons.Start.width, menuButtons.Start.height)
|
|
|
|
love.graphics.draw(menuButtons.Settings.text, menuButtons.Settings.x, menuButtons.Settings.y)
|
|
love.graphics.rectangle("line", menuButtons.Settings.x, menuButtons.Settings.y, menuButtons.Settings.width, menuButtons.Settings.height)
|
|
|
|
love.graphics.draw(menuButtons.Quit.text, menuButtons.Quit.x, menuButtons.Quit.y)
|
|
love.graphics.rectangle("line", menuButtons.Quit.x, menuButtons.Quit.y, menuButtons.Quit.width, menuButtons.Quit.height)
|
|
|
|
end
|
|
end
|
|
|
|
function titleCardUpdate(dt)
|
|
if RGB > 0 then
|
|
titleCard.elapsedTime = titleCard.elapsedTime + dt
|
|
RGB = 1 - (titleCard.elapsedTime/titleCard.targetTime)
|
|
print(RGB)
|
|
end
|
|
print("Elapsed:" .. titleCard.elapsedTime)
|
|
end |