Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a proper menu #20

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Fix the freeplay menu
  • Loading branch information
GuglioREAL committed Nov 6, 2021
commit 37c9b36db281edb894f538875795312cd5afbd2c
152 changes: 6 additions & 146 deletions src/love/states/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,153 +32,20 @@ local logo = graphics.newImage(love.graphics.newImage(graphics.imagePath("menu/l
local girlfriendTitle = love.filesystem.load("sprites/menu/girlfriend-title.lua")()
local titleEnter = love.filesystem.load("sprites/menu/titleEnter.lua")()

local menuNames = {
"Story Mode",
"Freeplay",
"Options"
}

local weekMeta = {
{
"Tutorial",
{
"Tutorial"
}
},
{
"Week 1",
{
"Bopeebo",
"Fresh",
"Dadbattle"
}
},
{
"Week 2",
{
"Spookeez",
"South",
"Monster"
}
},
{
"Week 3",
{
"Pico",
"Philly Nice",
"Blammed"
}
},
{
"Week 4",
{
"Satin Panties",
"High",
"M.I.L.F"
}
},
{
"Week 5",
{
"Cocoa",
"Eggnog",
"Winter Horrorland"
}
},
{
"Week 6",
{
"Senpai",
"Roses",
"Thorns"
}
}
}
local difficultyStrs = {
"-easy",
"",
"-hard"
}

local selectSound = love.audio.newSource("sounds/menu/select.ogg", "static")
local confirmSound = love.audio.newSource("sounds/menu/confirm.ogg", "static")

local music = love.audio.newSource("music/menu/menu.ogg", "stream")

local function switchMenu(menu)
if menu == 4 then
love.window.showMessageBox("lol", "Not implemented yet :P")

return switchMenu(1)
elseif menu == 3 then
function upFunc()
if menuState == 3 then
songDifficulty = (songDifficulty > 1) and songDifficulty - 1 or 3
elseif menuState == 2 then
songNum = (songNum > 1) and songNum - 1 or #weekMeta[weekNum][2]
else
weekNum = (weekNum > 1) and weekNum - 1 or #weekMeta
end
end
function downFunc()
if menuState == 3 then
songDifficulty = (songDifficulty < 3) and songDifficulty + 1 or 1
elseif menuState == 2 then
songNum = (songNum < #weekMeta[weekNum][2]) and songNum + 1 or 1
else
weekNum = (weekNum < #weekMeta) and weekNum + 1 or 1
end
end

function backFunc()
if menuState == 1 then
switchMenu(1)
else
menuState = menuState - 1
end
end

elseif menu == 2 then
weekNum = 1
songNum = 1

function upFunc()
if menuState == 2 then
songDifficulty = (songDifficulty > 1) and songDifficulty - 1 or 3
else
weekNum = (weekNum > 1) and weekNum - 1 or #weekMeta
end
end
function downFunc()
if menuState == 2 then
songDifficulty = (songDifficulty < 3) and songDifficulty + 1 or 1
else
weekNum = (weekNum < #weekMeta) and weekNum + 1 or 1
end
end

function backFunc()
if menuState == 1 then
switchMenu(1)
else
menuState = menuState - 1
end
end
else
function upFunc()
menuNum = (menuNum > 1) and menuNum - 1 or #menuNames
end
function downFunc()
menuNum = (menuNum < #menuNames) and menuNum + 1 or 1
end
function confirmFunc()
status.setLoading(true)
Gamestate.switch(menuSelect)
status.setLoading(false)
end
function backFunc()
graphics.fadeOut(0.5, love.event.quit)
end

end

menuState = 1
end
Expand All @@ -193,6 +60,7 @@ music:setLooping(true)

return {
enter = function(self, previous)
titleEnter:animate("anim", true)
songNum = 0

cam.sizeX, cam.sizeY = 0.9, 0.9
Expand All @@ -212,19 +80,12 @@ return {
--titleEnter:animate("anim", true)

if not graphics.isFading() then
if input:pressed("up") then
audio.playSound(selectSound)

upFunc()
elseif input:pressed("down") then
audio.playSound(selectSound)

downFunc()
elseif input:pressed("confirm") then
if input:pressed("confirm") then
audio.playSound(confirmSound)

titleEnter:animate("pressed", false)


confirmFunc()
elseif input:pressed("back") then
audio.playSound(selectSound)
Expand All @@ -246,8 +107,7 @@ return {
girlfriendTitle:draw()
titleEnter:draw()

--drawFunc()
love.graphics.pop()
love.graphics.pop()
love.graphics.pop()
end,

Expand Down
7 changes: 6 additions & 1 deletion src/love/states/menuFreeplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,12 @@ return {
elseif input:pressed("back") then
audio.playSound(selectSound)

Gamestate.switch(menuSelect)
if menuState == 1 then
Gamestate.switch(menuSelect)
else
menuState = menuState - 1
end

end
end
end,
Expand Down
4 changes: 4 additions & 0 deletions src/love/states/menuSelect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,13 @@ return {

--confirmFunc()
if menuButton == 1 then
status.setLoading(true)
Gamestate.switch(menuWeek)
status.setLoading(false)
elseif menuButton == 2 then
status.setLoading(true)
Gamestate.switch(menuFreeplay)
status.setLoading(false)
elseif menuButton == 3 then
love.window.showMessageBox("lol", "Not implemented yet :P")
end
Expand Down
10 changes: 3 additions & 7 deletions src/love/states/menuWeek.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ local difficultyStrs = {
"-hard"
}


tutorial = graphics.newImage(love.graphics.newImage(graphics.imagePath("menu/storymenu/week0")))
week1 = graphics.newImage(love.graphics.newImage(graphics.imagePath("menu/storymenu/week1")))
week2 = graphics.newImage(love.graphics.newImage(graphics.imagePath("menu/storymenu/week2")))
Expand All @@ -58,12 +59,6 @@ week6 = graphics.newImage(love.graphics.newImage(graphics.imagePath("menu/storym

enemyDanceLines.sizeX, enemyDanceLines.sizeY = 0.5, 0.5







local selectSound = love.audio.newSource("sounds/menu/select.ogg", "static")
local confirmSound = love.audio.newSource("sounds/menu/confirm.ogg", "static")

Expand Down Expand Up @@ -133,6 +128,7 @@ music:setLooping(true)

return {
enter = function(self, previous)
bfDanceLines:animate("boyfriend", true)
enemyDanceLines:animate("none", true)
songNum = 0

Expand Down Expand Up @@ -250,7 +246,6 @@ return {
else
songDifficulty = 3
end

elseif input:pressed("right") then
audio.playSound(selectSound)

Expand All @@ -261,6 +256,7 @@ return {
end
elseif input:pressed("confirm") then
audio.playSound(confirmSound)
bfDanceLines:animate("boyfriend confirm", false)

confirmFunc()
elseif input:pressed("back") then
Expand Down