id_
This commit is contained in:
parent
b19f58726c
commit
01d272981e
133 changed files with 822 additions and 66 deletions
43
level_editor/object_attributes.lua
Normal file
43
level_editor/object_attributes.lua
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
require "libs/TSerial"
|
||||
|
||||
local targetFolder = "art"
|
||||
|
||||
function get(folder)
|
||||
|
||||
end
|
||||
|
||||
function getAllAssets()
|
||||
local objectnames = {}
|
||||
local topFolder = "art"
|
||||
local files = love.filesystem.getDirectoryItems(topFolder)
|
||||
for _, folder in pairs(files) do
|
||||
if string.sub(folder, 1, 1) ~= "_" then
|
||||
-- we ignore directories which are prepended w/ an underscore
|
||||
if not string.find(folder, "%.") then
|
||||
objectnames[folder] = {}
|
||||
love.filesystem.createDirectory("art/" .. folder)
|
||||
-- this is a folder, probably
|
||||
local newFiles = love.filesystem.getDirectoryItems(topFolder .. "/" .. folder)
|
||||
for _, fileToAnalyze in pairs(newFiles) do
|
||||
if fileToAnalyze:find("_r.png") or fileToAnalyze:find("_g.png") or fileToAnalyze:find("_b.png")then
|
||||
local color
|
||||
|
||||
if fileToAnalyze:find("_r.png") then color = "red"
|
||||
elseif fileToAnalyze:find("_g.png") then color = "green"
|
||||
elseif fileToAnalyze:find("_b.png") then color = "blue" end
|
||||
|
||||
local name = fileToAnalyze:sub(1, fileToAnalyze:len() - 6)
|
||||
if not objectnames[folder][name] then
|
||||
objectnames[folder][name] = {}
|
||||
end
|
||||
objectnames[folder][name][color] = topFolder .. "/" .. folder .. "/" .. fileToAnalyze
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
str = TSerial.pack(objectnames, nil, true)
|
||||
love.filesystem.write("great.sav", str)
|
||||
return objectnames
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue