diff --git a/TODO b/TODO index a5785bb..af16d60 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,7 @@ -FAILED lol -write ruby script to output json table for processed art - -flesh out full mythos, i.e.: where is the player, why is the player here, what is the player trying to get, who is here, what do they thin_ of the player's presence (are they happy? is the player an old face to them?) -decide on dialog trees -YES -should puzzles be sort of secondary to exploration? li_e should most of the game be weird fun and interaction, and then the 'off the rails' parts should be puzzles??? +YES -should puzzles be sort of secondary to exploration? li_e should most of the game be weird fun and interaction, and then the 'off the rails' parts should be puzzles??? all of the npcs should be stuc_ in a cycle of whatever they're doing, focused on it, hav always been focused on it, maybe it has to do w/ the fact that they are always doing 'night activities' diff --git a/level_editor/editor.lua b/level_editor/editor.lua index 457d4f1..eb707be 100644 --- a/level_editor/editor.lua +++ b/level_editor/editor.lua @@ -18,6 +18,8 @@ local gameAssets = getAllAssets() local inputText = "" local assetProperties = {} +local hierarchy = {} + local activeField = nil --this is for whenwe are doing text input things local uiButtons = {} @@ -33,7 +35,15 @@ function _initLevelEditor() --create folder buttons local counter = 1 - for folder, object in pairs(gameAssets) do + + for asset, attributes in pairs(gameAssets) do + if not hierarchy[gameAssets[asset].directory] then + hierarchy[gameAssets[asset].directory] = {} + end + table.insert(hierarchy[gameAssets[asset].directory], asset) + end + + for folder, object in pairs(hierarchy) do local button = createUIElement{ name = "folder", text = folder, @@ -137,7 +147,7 @@ function selectFolder(folder) local counter = 1 local limit = 10 - for asset, colorArray in pairs(gameAssets[selectedFolder]) do + for _, asset in pairs(hierarchy[selectedFolder]) do if counter % limit == 0 then counter = 1 @@ -163,7 +173,7 @@ function selectFolder(folder) local sprites = {} - for color, location in pairs(colorArray) do + for color, location in pairs(gameAssets[asset].sprites) do sprites[color] = love.graphics.newImage(location) end @@ -195,18 +205,12 @@ function selectAsset(asset) end function editAsset(asset) - assetProperties = { - class = "", - } - inputText = "" editorView = "asset" selectedAsset = asset - local filename = "art/" .. selectedFolder .. "/" .. selectedAsset .. ".prop" - if love.filesystem.exists(filename) then - assetProperties = TSerial.unpack(love.filesystem.read(filename)) - end + assetProperties = gameAssets[selectedAsset] + local cancelButton = createUIElement{ name = "cancel", @@ -237,9 +241,8 @@ function editAsset(asset) editingAssetButtons[cancelButton] = cancelButton editingAssetButtons[confirmButton] = confirmButton - local assetSprites = {} - for color, path in pairs(gameAssets[selectedFolder][selectedAsset]) do + for color, path in pairs(assetProperties.sprites) do assetSprites[color] = love.graphics.newImage(path) end @@ -268,14 +271,34 @@ function editAsset(asset) } } + local preloadLabel = { + draw = function() love.graphics.printf("preload", 0, 225, sideBarBox.w, "center") end + } + + labels[preloadLabel] = preloadLabel + + local preloadButton = createUIElement{ + name = "preload", + text = tostring(assetProperties.preload), + x = 25, + y = 250, + onClic = { + left = function() + assetProperties.preload = not assetProperties.preload + end + } + } + editingAssetButtons[assetButton] = assetButton editingAssetButtons.class = classButton + editingAssetButtons.preload = preloadButton + end function saveAsset() - local save = TSerial.pack(assetProperties, nil, true) - diditdoit = love.filesystem.write("art/" .. selectedFolder .. "/" .. selectedAsset .. ".prop", save) - print("fdfdfdfd", diditdoit) + gameAssets[selectedAsset] = assetProperties + local save = TSerial.pack(gameAssets, nil, true) + love.filesystem.write("assets.prop", save) assetsView() end @@ -350,8 +373,9 @@ end function editorCompleteResponse() if editorView == "asset" then assetProperties[activeField] = inputText + print(assetProperties[activeField], "BLELERLLLRLRLRR") end - print(assetProperties[activeField], "ass") + print(activeField, assetProperties[activeField], "ass") activeField = nil end diff --git a/level_editor/object_attributes.lua b/level_editor/object_attributes.lua index 49f3af5..72109bb 100644 --- a/level_editor/object_attributes.lua +++ b/level_editor/object_attributes.lua @@ -7,6 +7,7 @@ function get(folder) end function getAllAssets() + local properties = TSerial.unpack(love.filesystem.read("assets.prop") or "{}") local objectnames = {} local topFolder = "art" local files = love.filesystem.getDirectoryItems(topFolder) @@ -15,29 +16,33 @@ function getAllAssets() -- we ignore directories which are prepended w/ an underscore if not string.find(folder, "%.") then objectnames[folder] = {} - love.filesystem.createDirectory("art/" .. 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] = {} + + if not properties[name] then + properties[name] = {} + properties[name].directory = folder + properties[name].sprites = {} + properties[name].class = "unmoveable" + properties[name].preload = false end - objectnames[folder][name][color] = topFolder .. "/" .. folder .. "/" .. fileToAnalyze + properties[name].sprites[color] = topFolder .. "/" .. folder .. "/" .. fileToAnalyze end end end end end - str = TSerial.pack(objectnames, nil, true) - love.filesystem.write("great.sav", str) - return objectnames + str = TSerial.pack(properties, nil, true) + love.filesystem.write("assets.prop", str) + return properties end \ No newline at end of file