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
|
||||||
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 {
|
return {
|
||||||
name = "level1",
|
name = "level1",
|
||||||
|
@ -57,6 +69,8 @@ return {
|
||||||
objects = {}
|
objects = {}
|
||||||
}
|
}
|
||||||
]]
|
]]
|
||||||
-- Make log stuff
|
if logging then
|
||||||
os.execute( "mkdir \"./Mothback/logs\"" )
|
-- Make log stuff
|
||||||
logFile = io.open("Mothback/logs/mothback_"..os.date("%Y-%m-%d_%H-%M-%S")..".log", "a+")
|
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()
|
function LevelLoadTiles()
|
||||||
|
|
||||||
LevelData = dofile("Mothback/data/levels/"..currLevel..".lua")
|
LevelData = dofile("Mothback/data/levels/"..currLevel)
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
on level format:
|
on level format:
|
||||||
|
|
8
main.lua
8
main.lua
|
@ -1,6 +1,7 @@
|
||||||
function love.load()
|
function love.load()
|
||||||
logging = true
|
logging = true
|
||||||
if logging then print("love: "..collectgarbage("count").." kB") end
|
loveMemUsage = collectgarbage("count")
|
||||||
|
loveInitLog = "love: "..loveMemUsage.." kB, time: "..os.clock().." seconds"
|
||||||
arrow = 0
|
arrow = 0
|
||||||
|
|
||||||
menu_type = "no"
|
menu_type = "no"
|
||||||
|
@ -26,6 +27,8 @@ function love.load()
|
||||||
}
|
}
|
||||||
|
|
||||||
require "data/scripts"
|
require "data/scripts"
|
||||||
|
logPrint(loveInitLog)
|
||||||
|
loveInitLog = nil
|
||||||
Canvas = {
|
Canvas = {
|
||||||
Darkness = CreateDarkness()
|
Darkness = CreateDarkness()
|
||||||
}
|
}
|
||||||
|
@ -36,9 +39,10 @@ function love.load()
|
||||||
Camera.width = game.width
|
Camera.width = game.width
|
||||||
Camera.height = game.height
|
Camera.height = game.height
|
||||||
|
|
||||||
levelList = {"level1","2","3","ewae","tileset"}
|
levelList = scandir("./Mothback/data/levels")
|
||||||
levelNum = 1
|
levelNum = 1
|
||||||
currLevel = levelList[levelNum]
|
currLevel = levelList[levelNum]
|
||||||
|
logPrint("currLevel: "..currLevel)
|
||||||
LoadedEntities = {}
|
LoadedEntities = {}
|
||||||
LoadedParticles = {}
|
LoadedParticles = {}
|
||||||
LevelLoadTiles()
|
LevelLoadTiles()
|
||||||
|
|
Loading…
Reference in New Issue