new menu!
This commit is contained in:
parent
fd2f5921f7
commit
2ba6d387ad
BIN
images/MenuLeft.png
Normal file
BIN
images/MenuLeft.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
BIN
images/MenuLeft.png~
Normal file
BIN
images/MenuLeft.png~
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.6 KiB |
57
main.lua
57
main.lua
@ -10,6 +10,7 @@ local songs = require("charts.songs")
|
||||
|
||||
local curSong = songs[1]
|
||||
local curIndex = 1
|
||||
local evilCurIndex = 1
|
||||
local curDiffList = songs[1].difficulties
|
||||
|
||||
local curDiff = songs[1].difficulties[1]
|
||||
@ -25,9 +26,12 @@ local logo
|
||||
local gf
|
||||
local freaky = love.audio.newSource("sounds/freakyMenu.ogg", "stream")
|
||||
|
||||
local left
|
||||
|
||||
local function setup()
|
||||
bg = myTypes.Image("images/menuBG.png", 0)
|
||||
bg.ui = false
|
||||
bg.layer = -10
|
||||
|
||||
gf = myTypes.Sprite("sprites/gfDanceTitle.png", "sprites/gfDanceTitle.json")
|
||||
gf:PlayAnimation("gfDance", 24, true)
|
||||
@ -35,10 +39,16 @@ local function setup()
|
||||
for index, rect in next, gf.quads.gfDance do
|
||||
rect.resize = myTypes.Vector2(0.7,.7)
|
||||
end
|
||||
gf.layer = 3
|
||||
|
||||
logo = myTypes.Sprite("sprites/logoBumpin.png", "sprites/logoBumpin.json")
|
||||
logo:PlayAnimation("logo bumpin", 24, true)
|
||||
logo.position = myTypes.Vector2(-80, 0)
|
||||
left = myTypes.Image("images/MenuLeft.png")
|
||||
left.layer = 0
|
||||
left.resize = myTypes.Vector2(3, 1)
|
||||
|
||||
local arrow = myTypes.Image("images/eventArrow.png")
|
||||
arrow.position.y = 330
|
||||
arrow.layer = 1
|
||||
arrow.resize = myTypes.Vector2(.5,.5)
|
||||
|
||||
freaky:play()
|
||||
end
|
||||
@ -49,6 +59,8 @@ local gettingKey
|
||||
|
||||
local settings = json.parse(files.read_file("settings.json"))
|
||||
local keybinds = settings.Keybinds
|
||||
local scroll = love.audio.newSource("sounds/ui/scrollMenu.ogg", "static")
|
||||
local confirm = love.audio.newSource("sounds/ui/confirmMenu.ogg", "static")
|
||||
|
||||
function love.update(dt)
|
||||
if curState and curState.loaded then
|
||||
@ -68,8 +80,17 @@ function love.draw()
|
||||
if curState and stateLoaded then
|
||||
curState.draw()
|
||||
else
|
||||
|
||||
myTypes.drawSprites()
|
||||
love.graphics.print({{0,0,0}, string.format("SONG: %s, DIFFICULTY: %s", curSong.name, curDiff)}, font, love.graphics.getWidth()/4, love.graphics:getHeight()/2 + 250, 0, 1, 1, 200)
|
||||
|
||||
evilCurIndex = myMath.lerp(evilCurIndex, curIndex, .3)
|
||||
|
||||
for index, song in next, songs do
|
||||
love.graphics.print({{0,0,0}, song.name}, font, 300, love.graphics:getHeight()/2 + (50 * (index - evilCurIndex - .7)), 0, 1, 1, 200)
|
||||
end
|
||||
|
||||
love.graphics.print({{0,0,0}, curDiff}, font, 600, 660)
|
||||
|
||||
love.graphics.print(
|
||||
{{0,0,0}, string.format("Left: %s, Down: %s, Up: %s, Right: %s \nDownscroll: %s",
|
||||
keybinds[1],
|
||||
@ -121,16 +142,26 @@ function love.keypressed(key, un, is)
|
||||
end
|
||||
curDiffInd = 1
|
||||
curDiff = curDiffList[1]
|
||||
scroll:stop()
|
||||
scroll:play()
|
||||
elseif key == "up" then --the solution was so stupid easy
|
||||
if songs[curIndex - 1] then
|
||||
curSong = songs[curIndex - 1]
|
||||
curDiffList = songs[curIndex - 1].difficulties
|
||||
curDiffInd = 1
|
||||
curDiff = curDiffList[curDiffInd]
|
||||
curIndex = curIndex - 1
|
||||
else
|
||||
curSong = songs[1]
|
||||
curIndex = 1
|
||||
curSong = songs[#songs]
|
||||
curIndex = #songs
|
||||
curDiffList = songs[curIndex].difficulties
|
||||
curDiffInd = 1
|
||||
curDiff = curDiffList[curDiffInd]
|
||||
end
|
||||
curDiffInd = 1
|
||||
curDiff = curDiffList[1]
|
||||
scroll:stop()
|
||||
scroll:play()
|
||||
elseif key == "right" then
|
||||
if curDiffList[curDiffInd + 1] then
|
||||
curDiff = curDiffList[curDiffInd + 1]
|
||||
@ -139,17 +170,18 @@ function love.keypressed(key, un, is)
|
||||
curDiff = curDiffList[1]
|
||||
curDiffInd = 1
|
||||
end
|
||||
scroll:stop()
|
||||
scroll:play()
|
||||
elseif key == "left" then
|
||||
if curDiffList[curDiffInd - 1] then
|
||||
curDiff = curDiffList[curDiffInd - 1]
|
||||
curDiffInd = curDiffInd - 1
|
||||
elseif curDiffList[5] then
|
||||
curDiff = curDiffList[5]
|
||||
curDiffInd = 5
|
||||
else
|
||||
curDiff = curDiffList[3]
|
||||
curDiffInd = 3
|
||||
curDiff = curDiffList[#curDiffList]
|
||||
curDiffInd = #curDiffList
|
||||
end
|
||||
scroll:stop()
|
||||
scroll:play()
|
||||
elseif tonumber(key) and tonumber(key) < 5 then
|
||||
if key == "0" then
|
||||
settings.Downscroll = not settings.Downscroll
|
||||
@ -163,6 +195,9 @@ function love.keypressed(key, un, is)
|
||||
gettingKey = nil
|
||||
|
||||
files.write_file("settings.json", json.stringify(settings))
|
||||
|
||||
confirm:stop()
|
||||
confirm:play()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
BIN
sounds/ui/confirmMenu.ogg
Normal file
BIN
sounds/ui/confirmMenu.ogg
Normal file
Binary file not shown.
BIN
sounds/ui/scrollMenu.ogg
Normal file
BIN
sounds/ui/scrollMenu.ogg
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user