local state = require("modules.states.playstate") local myMath = require("modules.math") local myTypes = require("modules.types") local files = require("modules.files") local json = require("modules.json") local logging = require("modules.logging") local songs = json.parse(files.read_file("songs.json")) local curSong = "dad-battle" local curDiffList = {"erect"} local curDiff = "erect" local curState = nil local stateLoaded = false local pressed = {false,false,false} -- for index, song in next, songs do -- curSong = index -- curDiff = song[1] -- break -- end local gf = myTypes.Sprite("sprites/GF_assets.png", "sprites/GF_assets.json") gf.position = myTypes.Vector2(30, 30) gf:PlayAnimation("GF Dancing Beat", 24, true) function love.update(dt) if curState and curState.loaded then if stateLoaded then curState.update(dt) else stateLoaded = true -- skipping this update frame curState.finish() end elseif not curState then if love.keyboard.isDown("return") then gf:Destroy() curState = state(curSong, curDiff) curState.load() elseif love.keyboard.isDown("down") and not pressed[1] then curSong = next(songs, curSong) if not curSong then curSong = next(songs) curDiffList = songs[curSong] else curDiffList = songs[curSong] end curDiff = curDiffList[1] pressed[1] = true elseif love.keyboard.isDown("right") and not pressed[2] then local curDiffNum = 0 for index, diff in next, curDiffList do if diff == curDiff then curDiffNum = index + 1 end end curDiff = curDiffList[curDiffNum] or curDiff pressed[2] = true elseif love.keyboard.isDown("left") and not pressed[3] then local curDiffNum = 0 for index, diff in next, curDiffList do if diff == curDiff then curDiffNum = index - 1 end end curDiff = curDiffList[curDiffNum] or curDiff pressed[3] = true elseif not love.keyboard.isDown("down") then pressed[1] = false elseif not love.keyboard.isDown("right") then pressed[2] = false elseif not love.keyboard.isDown("left") then pressed[3] = false end myTypes.updateSprites(dt) end end function love.draw() if curState and stateLoaded then curState.draw() else myTypes.drawSprites() love.graphics.print(string.format("Song: %s, Difficulty: %s, List: %s", curSong, curDiff, logging.dump(curDiffList)), love.graphics.newFont(15, "light"), love.graphics:getWidth()/2, love.graphics:getHeight()/2 + 150, 0, 1, 1, 200) end end