Level list now pulled from "levels", changed log stuff.
This commit is contained in:
parent
2f19554279
commit
cbcf90de2d
|
@ -41,6 +41,18 @@ function ExportLevel(levelname, filename)
|
|||
end
|
||||
end
|
||||
|
||||
-- Source https://stackoverflow.com/a/11130774
|
||||
function scandir(directory)
|
||||
local i, t, popen = 0, {}, io.popen
|
||||
local pfile = popen('ls "'..directory..'"')
|
||||
for filename in pfile:lines() do
|
||||
i = i + 1
|
||||
t[i] = filename
|
||||
end
|
||||
pfile:close()
|
||||
return t
|
||||
end
|
||||
|
||||
--[[
|
||||
return {
|
||||
name = "level1",
|
||||
|
@ -57,6 +69,8 @@ return {
|
|||
objects = {}
|
||||
}
|
||||
]]
|
||||
-- Make log stuff
|
||||
os.execute( "mkdir \"./Mothback/logs\"" )
|
||||
logFile = io.open("Mothback/logs/mothback_"..os.date("%Y-%m-%d_%H-%M-%S")..".log", "a+")
|
||||
if logging then
|
||||
-- Make log stuff
|
||||
os.execute( "mkdir \"./Mothback/logs\"" )
|
||||
logFile = io.open("Mothback/logs/mothback_"..os.date("%Y-%m-%d_%H-%M-%S")..".log", "a+")
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function LevelLoadTiles()
|
||||
|
||||
LevelData = dofile("Mothback/data/levels/"..currLevel..".lua")
|
||||
LevelData = dofile("Mothback/data/levels/"..currLevel)
|
||||
|
||||
--[[
|
||||
on level format:
|
||||
|
|
8
main.lua
8
main.lua
|
@ -1,6 +1,7 @@
|
|||
function love.load()
|
||||
logging = true
|
||||
if logging then print("love: "..collectgarbage("count").." kB") end
|
||||
loveMemUsage = collectgarbage("count")
|
||||
loveInitLog = "love: "..loveMemUsage.." kB, time: "..os.clock().." seconds"
|
||||
arrow = 0
|
||||
|
||||
menu_type = "no"
|
||||
|
@ -26,6 +27,8 @@ function love.load()
|
|||
}
|
||||
|
||||
require "data/scripts"
|
||||
logPrint(loveInitLog)
|
||||
loveInitLog = nil
|
||||
Canvas = {
|
||||
Darkness = CreateDarkness()
|
||||
}
|
||||
|
@ -36,9 +39,10 @@ function love.load()
|
|||
Camera.width = game.width
|
||||
Camera.height = game.height
|
||||
|
||||
levelList = {"level1","2","3","ewae","tileset"}
|
||||
levelList = scandir("./Mothback/data/levels")
|
||||
levelNum = 1
|
||||
currLevel = levelList[levelNum]
|
||||
logPrint("currLevel: "..currLevel)
|
||||
LoadedEntities = {}
|
||||
LoadedParticles = {}
|
||||
LevelLoadTiles()
|
||||
|
|
Loading…
Reference in New Issue