Compare commits
2 Commits
Chunk
...
918c63c535
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
918c63c535 | ||
|
|
6fa7dcbeef |
@@ -1,51 +0,0 @@
|
|||||||
-- pieces of levels
|
|
||||||
|
|
||||||
Chunk = {all = {}}
|
|
||||||
Chunk.__index = Chunk
|
|
||||||
|
|
||||||
-- CLASS METHODS
|
|
||||||
|
|
||||||
-- box == nil for global chunks
|
|
||||||
function Chunk:new(filename, box)
|
|
||||||
local o = { filename = filename, box = box }
|
|
||||||
setmetatable(o, self)
|
|
||||||
self.all[o] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
function Chunk:getExportList()
|
|
||||||
local r = {}
|
|
||||||
for chunk in pairs(self.all) do
|
|
||||||
table.insert(r, {chunk.filename, chunk.box})
|
|
||||||
end
|
|
||||||
return r
|
|
||||||
end
|
|
||||||
|
|
||||||
-- INSTANCE METHODS
|
|
||||||
|
|
||||||
function Chunk:containsPoint(pt)
|
|
||||||
return self.box == nil or self.box:containsPoint(pt)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Chunk:load()
|
|
||||||
if self.loaded then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
logPrint("loading chunk "..self.filename)
|
|
||||||
self.data = dofile(level_current.."/chunks/"..self.filename)
|
|
||||||
self.loaded = { rooms = {}, collisions = {} }
|
|
||||||
LevelTiles = self.data.tiles
|
|
||||||
indexLevelTiles()
|
|
||||||
optimizeTileObjects(self.loaded.collisions)
|
|
||||||
|
|
||||||
for _, v in ipairs(self.data.rooms or {}) do
|
|
||||||
local room = Collision:new(v[1],v[2],v[3],v[4])
|
|
||||||
table.insert(self.data.rooms, room)
|
|
||||||
table.insert(LoadedObjects.Rooms, room)
|
|
||||||
end
|
|
||||||
logPrint("loaded chunk with "..#self.loaded.collisions.." collisions")
|
|
||||||
end
|
|
||||||
|
|
||||||
function Chunk:save(chunkdir)
|
|
||||||
return love.filesystem.write(chunkdir.."/"..self.filename, "return "..serialize_lua_value(self.data))
|
|
||||||
end
|
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ function stepEditor()
|
|||||||
if name_prompt.canceled then return end
|
if name_prompt.canceled then return end
|
||||||
Prompt:new({
|
Prompt:new({
|
||||||
name = "filename",
|
name = "filename",
|
||||||
input = "unnamed_level",
|
input = "level.lua",
|
||||||
func = function(file_prompt)
|
func = function(file_prompt)
|
||||||
if file_prompt.canceled then return end
|
if file_prompt.canceled then return end
|
||||||
exportLevel(name_prompt.input, file_prompt.input)
|
exportLevel(name_prompt.input, file_prompt.input)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ function drawGameworldBackground()
|
|||||||
for i = 1, #LevelTiles do
|
for i = 1, #LevelTiles do
|
||||||
for j = 1, #LevelTiles[i] do
|
for j = 1, #LevelTiles[i] do
|
||||||
if LevelTiles[i][j].id ~= 0 then
|
if LevelTiles[i][j].id ~= 0 then
|
||||||
|
|
||||||
local depth = TileData[LevelTiles[i][j].id].depth
|
local depth = TileData[LevelTiles[i][j].id].depth
|
||||||
drawTile(
|
drawTile(
|
||||||
LevelTiles[i][j],
|
LevelTiles[i][j],
|
||||||
|
|||||||
121
code/in_out.lua
121
code/in_out.lua
@@ -1,51 +1,90 @@
|
|||||||
function exportLevel(levelname, dirname)
|
function exportLevel(levelname, filename)
|
||||||
dirname = "export/"..dirname
|
love.filesystem.createDirectory("export")
|
||||||
|
filename = filename or "output.lua"
|
||||||
if love.filesystem.exists(dirname) then
|
if string.sub(filename, 1, 1) ~= "/" then
|
||||||
-- TODO: prompt to overwrite
|
filename = "export/"..filename
|
||||||
error("file already exists")
|
|
||||||
end
|
end
|
||||||
|
exportFile = io.open(filename, "w+")
|
||||||
|
|
||||||
local ok = love.filesystem.createDirectory(dirname)
|
if exportFile then
|
||||||
if not ok then
|
|
||||||
logPrint("error creating directory")
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
logPrint("Exporting level \"".. levelname .. "\"...")
|
logPrint("Exporting level \"".. levelname .. "\"...")
|
||||||
local exportTable = {}
|
exportFile:write("return {")
|
||||||
exportTable.name = levelname
|
|
||||||
exportTable.tileset = "library"
|
|
||||||
exportTable.properties = LevelData.properties
|
|
||||||
--exportTable.tiles = LevelTiles
|
|
||||||
--logPrint("- objects")
|
|
||||||
--exportTable.objects = { spawns = {}, rooms = {} }
|
|
||||||
--logPrint(" - spawns")
|
|
||||||
--for i, v in ipairs(LoadedObjects.Spawns) do
|
|
||||||
--exportTable.objects.spawns = {v.archetype.name,{},v.args}
|
|
||||||
--end
|
|
||||||
|
|
||||||
--logPrint(" - rooms")
|
logPrint("- level name")
|
||||||
|
exportFile:write("\n name = \"" .. levelname .. "\",")
|
||||||
|
|
||||||
--for i, room in ipairs(LoadedObjects.Rooms) do
|
logPrint("- tileset")
|
||||||
--- table.insert(exportTable.objects.rooms,{room:asRect():getCoords()})
|
for k, v in pairs(tileset) do
|
||||||
--end
|
if v == LevelData.tileset then
|
||||||
exportTable.chunks = Chunk:getExportList()
|
exportFile:write("\n tileset = tileset." .. k .. ",")
|
||||||
logPrint("Writing to file...")
|
|
||||||
local ok, err = love.filesystem.write(dirname.."/level.lua", "return "..serialize_lua_value(exportTable))
|
|
||||||
|
|
||||||
if ok then
|
|
||||||
logPrint("Saving chunks...")
|
|
||||||
local chunkdir = dirname.."/chunks"
|
|
||||||
love.filesystem.createDirectory(chunkdir)
|
|
||||||
for chunk in pairs(Chunk.all) do
|
|
||||||
local ok, err = chunk:save(chunkdir)
|
|
||||||
if not ok then error(err) end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
logPrint("- properties")
|
||||||
|
exportFile:write("\n properties = {")
|
||||||
|
logPrint(" - darkness: ".. tostring(LevelData.properties.darkness))
|
||||||
|
exportFile:write("\n darkness = " .. tostring(LevelData.properties.darkness))
|
||||||
|
exportFile:write("\n },")
|
||||||
|
|
||||||
|
logPrint("- tiles")
|
||||||
|
exportFile:write("\n tiles = {")
|
||||||
|
local rows = #LevelTiles
|
||||||
|
for i = 1, #LevelTiles do
|
||||||
|
if i > 1 then
|
||||||
|
exportFile:write(", ")
|
||||||
|
end
|
||||||
|
exportFile:write("\n { ")
|
||||||
|
for j = 1, #LevelTiles[i] do
|
||||||
|
if j ~= 1 then
|
||||||
|
exportFile:write(", ")
|
||||||
|
end
|
||||||
|
exportFile:write(tostring(LevelTiles[i][j].id))
|
||||||
|
end
|
||||||
|
exportFile:write("}")
|
||||||
|
logPrint(" - row "..i.."/"..rows.." "..math.floor(100*((i-1)*100/rows))/100 .."%")
|
||||||
|
end
|
||||||
|
exportFile:write("\n },")
|
||||||
|
logPrint("- objects")
|
||||||
|
exportFile:write("\n objects = {")
|
||||||
|
logPrint(" - spawns")
|
||||||
|
exportFile:write("\n spawns = {")
|
||||||
|
for i, v in ipairs(LoadedObjects.Spawns) do
|
||||||
|
if i > 1 then
|
||||||
|
exportFile:write(",")
|
||||||
|
end
|
||||||
|
exportFile:write("\n {")
|
||||||
|
exportFile:write(v.archetype.type)
|
||||||
|
exportFile:write(",{")
|
||||||
|
for i=1, #v.args do
|
||||||
|
if i > 1 then
|
||||||
|
exportFile:write(",")
|
||||||
|
end
|
||||||
|
exportFile:write(v.args[i])
|
||||||
|
end
|
||||||
|
exportFile:write("}}")
|
||||||
|
end
|
||||||
|
exportFile:write("\n },")
|
||||||
|
logPrint(" - rooms")
|
||||||
|
exportFile:write("\n rooms = {")
|
||||||
|
for i, room in ipairs(LoadedObjects.Rooms) do
|
||||||
|
if i > 1 then
|
||||||
|
exportFile:write(",")
|
||||||
|
end
|
||||||
|
exportFile:write("\n {{")
|
||||||
|
exportFile:write(room.from.x)
|
||||||
|
exportFile:write(",")
|
||||||
|
exportFile:write(room.from.y)
|
||||||
|
exportFile:write("},{")
|
||||||
|
exportFile:write(room.to.x)
|
||||||
|
exportFile:write(",")
|
||||||
|
exportFile:write(room.to.y)
|
||||||
|
exportFile:write("}}")
|
||||||
|
end
|
||||||
|
exportFile:write("\n },")
|
||||||
|
exportFile:write("\n },")
|
||||||
logPrint("Exporting complete.")
|
logPrint("Exporting complete.")
|
||||||
else
|
exportFile:write("\n}")
|
||||||
-- TODO: clean up created files
|
exportFile:close()
|
||||||
logPrint("Exporting failed: "..err)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
104
code/level.lua
104
code/level.lua
@@ -1,25 +1,7 @@
|
|||||||
function loadLevelTiles()
|
function loadLevelTiles()
|
||||||
math.randomseed(3)
|
math.randomseed(3)
|
||||||
level_current = "data/levels/level1"
|
LevelData = dofile("data/levels/"..level_current)
|
||||||
LevelData = dofile(level_current.."/level.lua")
|
|
||||||
LoadedObjects.Collisions = {}
|
|
||||||
LoadedObjects.Platforms = {}
|
|
||||||
LoadedObjects.Ladders = {}
|
|
||||||
LoadedObjects.Hazards = {}
|
|
||||||
if type(LevelData.tileset) == "string" then
|
|
||||||
LevelData.tileset_name = LevelData.tileset
|
|
||||||
end
|
|
||||||
LevelData.tileset = tileset[LevelData.tileset_name]
|
|
||||||
|
|
||||||
getLevelTileData()
|
|
||||||
|
|
||||||
for _, v in ipairs(LevelData.chunks) do
|
|
||||||
Chunk:new(v[1], v[2])
|
|
||||||
end
|
|
||||||
local global_chunk = next(Chunk.all)
|
|
||||||
global_chunk:load()
|
|
||||||
LoadedObjects.Collisions = global_chunk.loaded.collisions
|
|
||||||
LevelTiles = global_chunk.data.tiles
|
|
||||||
--[[
|
--[[
|
||||||
on level format:
|
on level format:
|
||||||
|
|
||||||
@@ -30,26 +12,26 @@ function loadLevelTiles()
|
|||||||
overlay_depth = foreground/background overlay depth
|
overlay_depth = foreground/background overlay depth
|
||||||
type = collision type
|
type = collision type
|
||||||
]]
|
]]
|
||||||
|
getLevelTileData()
|
||||||
|
LevelTiles = LevelData.tiles
|
||||||
updateLevelDimensions()
|
updateLevelDimensions()
|
||||||
--
|
indexLevelTiles()
|
||||||
--createTileObjects()
|
createTileObjects()
|
||||||
--createRoomObjects()
|
createRoomObjects()
|
||||||
--getSpawns()
|
getSpawns()
|
||||||
end
|
end
|
||||||
|
|
||||||
function createRoomObjects()
|
function createRoomObjects()
|
||||||
LoadedObjects.Rooms = {}
|
LoadedObjects.Rooms = {}
|
||||||
for _, v in pairs(LevelData.objects.rooms) do
|
for _, v in pairs(LevelData.objects.rooms) do
|
||||||
table.insert(LoadedObjects.Rooms, Collision:new(v[1],v[2],v[3],v[4]))
|
table.insert(LoadedObjects.Rooms, Collision:new(v[1][1],v[1][2],v[2][1],v[2][2]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function getSpawns()
|
function getSpawns()
|
||||||
LoadedObjects.Spawns = {}
|
LoadedObjects.Spawns = {}
|
||||||
for _, v in pairs(LevelData.objects.spawns) do
|
for _, v in pairs(LevelData.objects.spawns) do
|
||||||
--addSpawn(v[1],unpack(v[2]))
|
addSpawn(v[1],unpack(v[2]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -139,8 +121,11 @@ function reduceLevelCanvas(horizontal,vertical)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function getLevelTileData()
|
function getLevelTileData()
|
||||||
TileData = dofile("data/tileset/"..LevelData.tileset_name..".lua")
|
for k, v in pairs(tileset) do
|
||||||
|
if v == LevelData.tileset then
|
||||||
|
TileData = dofile("data/tileset/"..k..".lua")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function reloadLevelTiles()
|
function reloadLevelTiles()
|
||||||
@@ -174,10 +159,10 @@ end
|
|||||||
|
|
||||||
function indexLevelTiles()
|
function indexLevelTiles()
|
||||||
TileIndex = {}
|
TileIndex = {}
|
||||||
local this_tileset = LevelData.tileset
|
|
||||||
-- index from tileset
|
-- index from tileset
|
||||||
local width = this_tileset:getPixelWidth()/tile_properties.width
|
local width = LevelData.tileset:getPixelWidth()/tile_properties.width
|
||||||
local height = this_tileset:getPixelHeight()/tile_properties.height
|
local height = LevelData.tileset:getPixelHeight()/tile_properties.height
|
||||||
for i = 0, height do
|
for i = 0, height do
|
||||||
for j = 0, width do
|
for j = 0, width do
|
||||||
TileIndex[i*width+j+1] = love.graphics.newQuad(
|
TileIndex[i*width+j+1] = love.graphics.newQuad(
|
||||||
@@ -185,7 +170,7 @@ function indexLevelTiles()
|
|||||||
i*tile_properties.height,
|
i*tile_properties.height,
|
||||||
tile_properties.width,
|
tile_properties.width,
|
||||||
tile_properties.height,
|
tile_properties.height,
|
||||||
this_tileset:getDimensions()
|
LevelData.tileset:getDimensions()
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -235,9 +220,6 @@ end
|
|||||||
function instanceTile(id)
|
function instanceTile(id)
|
||||||
local tile = {}
|
local tile = {}
|
||||||
|
|
||||||
if type(id) == "table" then
|
|
||||||
id = id.id
|
|
||||||
end
|
|
||||||
tile.id = id
|
tile.id = id
|
||||||
local Properties = TileData[tile.id]
|
local Properties = TileData[tile.id]
|
||||||
|
|
||||||
@@ -276,7 +258,7 @@ function drawGridDisplay()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function optimizeTileObjects(dest)
|
function optimizeTileObjects()
|
||||||
logPrint("Optimizing Objects...")
|
logPrint("Optimizing Objects...")
|
||||||
local unoptimized = 0
|
local unoptimized = 0
|
||||||
local isTileOptimized = {}
|
local isTileOptimized = {}
|
||||||
@@ -288,9 +270,8 @@ function optimizeTileObjects(dest)
|
|||||||
end
|
end
|
||||||
for i = 1, #LevelTiles do
|
for i = 1, #LevelTiles do
|
||||||
for j = 1, #LevelTiles[i] do
|
for j = 1, #LevelTiles[i] do
|
||||||
if LevelTiles[i][j].id ~= 0 and TileData[LevelTiles[i][j].id] then
|
if LevelTiles[i][j].id ~= 0 then
|
||||||
local tile_dat = TileData[LevelTiles[i][j].id]
|
local type = TileData[LevelTiles[i][j].id].type
|
||||||
local type = tile_dat.type
|
|
||||||
if type == "whole" and not isTileOptimized[i][j] then
|
if type == "whole" and not isTileOptimized[i][j] then
|
||||||
isTileOptimized[i][j] = true
|
isTileOptimized[i][j] = true
|
||||||
local n = 1
|
local n = 1
|
||||||
@@ -356,27 +337,29 @@ function optimizeTileObjects(dest)
|
|||||||
base_x + tile_properties.width * tile_properties.scale * n,
|
base_x + tile_properties.width * tile_properties.scale * n,
|
||||||
base_y + tile_properties.height * tile_properties.scale * m
|
base_y + tile_properties.height * tile_properties.scale * m
|
||||||
)
|
)
|
||||||
table.insert(dest,col)
|
table.insert(LoadedObjects.Collisions,col)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--logPrint("collisions optimized from " .. unoptimized .. " to " .. #LoadedObjects.Collisions)
|
logPrint("collisions optimized from " .. unoptimized .. " to " .. #LoadedObjects.Collisions)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- currently broken
|
function createTileObjects()
|
||||||
function createTileObjects(dest)
|
LoadedObjects.Collisions = {}
|
||||||
|
LoadedObjects.Platforms = {}
|
||||||
|
LoadedObjects.Ladders = {}
|
||||||
|
LoadedObjects.Hazards = {}
|
||||||
|
|
||||||
|
optimizeTileObjects()
|
||||||
optimizeTileObjects(dest.collisions)
|
|
||||||
|
|
||||||
for i = 1, #LevelTiles do
|
for i = 1, #LevelTiles do
|
||||||
for j = 1, #LevelTiles[i] do
|
for j = 1, #LevelTiles[i] do
|
||||||
if LevelTiles[i][j].id ~= 0 then
|
if LevelTiles[i][j].id ~= 0 then
|
||||||
local tile_dat = TileData[LevelTiles[i][j].id] or {}
|
|
||||||
local type = tile_dat.type
|
local type = TileData[LevelTiles[i][j].id].type
|
||||||
local light = tile_dat.light
|
local light = TileData[LevelTiles[i][j].id].light
|
||||||
local base_x = tile_properties.scale * j * tile_properties.width + tile_properties.scale * (level_properties.offset.x - tile_properties.height)
|
local base_x = tile_properties.scale * j * tile_properties.width + tile_properties.scale * (level_properties.offset.x - tile_properties.height)
|
||||||
local base_y = tile_properties.scale * i * tile_properties.height + tile_properties.scale * (level_properties.offset.y - tile_properties.height)
|
local base_y = tile_properties.scale * i * tile_properties.height + tile_properties.scale * (level_properties.offset.y - tile_properties.height)
|
||||||
|
|
||||||
@@ -389,9 +372,6 @@ function createTileObjects(dest)
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
local col
|
|
||||||
local list = dest.collisions
|
|
||||||
|
|
||||||
-- wholes are handled in optimization now
|
-- wholes are handled in optimization now
|
||||||
--[[if type == "whole" then
|
--[[if type == "whole" then
|
||||||
local col = Collision:new(
|
local col = Collision:new(
|
||||||
@@ -403,33 +383,33 @@ function createTileObjects(dest)
|
|||||||
table.insert(LoadedObjects.Collisions,col)
|
table.insert(LoadedObjects.Collisions,col)
|
||||||
else]]if type == "half_bottom" then
|
else]]if type == "half_bottom" then
|
||||||
|
|
||||||
col = Collision:new(
|
local col = Collision:new(
|
||||||
base_x,
|
base_x,
|
||||||
base_y + tile_properties.height/2 * tile_properties.scale,
|
base_y + tile_properties.height/2 * tile_properties.scale,
|
||||||
base_x + tile_properties.width * tile_properties.scale,
|
base_x + tile_properties.width * tile_properties.scale,
|
||||||
base_y + tile_properties.height * tile_properties.scale
|
base_y + tile_properties.height * tile_properties.scale
|
||||||
)
|
)
|
||||||
|
table.insert(LoadedObjects.Collisions,col)
|
||||||
|
|
||||||
elseif type == "half_top" then
|
elseif type == "half_top" then
|
||||||
|
|
||||||
col = Collision:new(
|
local col = Collision:new(
|
||||||
base_x,
|
base_x,
|
||||||
base_y ,
|
base_y ,
|
||||||
base_x + tile_properties.width * tile_properties.scale,
|
base_x + tile_properties.width * tile_properties.scale,
|
||||||
base_y + tile_properties.height/2 * tile_properties.scale
|
base_y + tile_properties.height/2 * tile_properties.scale
|
||||||
)
|
)
|
||||||
|
table.insert(LoadedObjects.Collisions,col)
|
||||||
|
|
||||||
elseif type == "half_right" then
|
elseif type == "half_right" then
|
||||||
|
|
||||||
col = Collision:new(
|
local col = Collision:new(
|
||||||
base_x + tile_properties.height/2 * tile_properties.scale,
|
base_x + tile_properties.height/2 * tile_properties.scale,
|
||||||
base_y,
|
base_y,
|
||||||
base_x + tile_properties.width * tile_properties.scale,
|
base_x + tile_properties.width * tile_properties.scale,
|
||||||
base_y + tile_properties.height * tile_properties.scale
|
base_y + tile_properties.height * tile_properties.scale
|
||||||
)
|
)
|
||||||
|
table.insert(LoadedObjects.Collisions,col)
|
||||||
|
|
||||||
elseif type == "half_left" then
|
elseif type == "half_left" then
|
||||||
|
|
||||||
@@ -600,8 +580,7 @@ function createTileObjects(dest)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: fix ladders
|
elseif type == "ladder_right" then
|
||||||
--[[elseif type == "ladder_right" then
|
|
||||||
|
|
||||||
local ladder = Collision:new(
|
local ladder = Collision:new(
|
||||||
base_x + (tile_properties.width-4)* tile_properties.scale,
|
base_x + (tile_properties.width-4)* tile_properties.scale,
|
||||||
@@ -659,7 +638,7 @@ function createTileObjects(dest)
|
|||||||
)
|
)
|
||||||
table.insert(LoadedObjects.Platforms,plat)
|
table.insert(LoadedObjects.Platforms,plat)
|
||||||
|
|
||||||
]]elseif type == "bottom_hazard" then
|
elseif type == "bottom_hazard" then
|
||||||
|
|
||||||
|
|
||||||
local hazard = Collision:new(
|
local hazard = Collision:new(
|
||||||
@@ -668,10 +647,9 @@ function createTileObjects(dest)
|
|||||||
base_x + tile_properties.width * tile_properties.scale,
|
base_x + tile_properties.width * tile_properties.scale,
|
||||||
base_y + tile_properties.height * tile_properties.scale
|
base_y + tile_properties.height * tile_properties.scale
|
||||||
)
|
)
|
||||||
list = dest.hazards
|
table.insert(LoadedObjects.Hazards,hazard)
|
||||||
|
|
||||||
end
|
end
|
||||||
table.insert(list, col)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ require "data/sfx"
|
|||||||
require "code/locale"
|
require "code/locale"
|
||||||
|
|
||||||
-- support functions
|
-- support functions
|
||||||
require "code/serialize"
|
|
||||||
require "code/math"
|
require "code/math"
|
||||||
require "code/draw"
|
require "code/draw"
|
||||||
require "code/hex"
|
require "code/hex"
|
||||||
@@ -16,7 +15,6 @@ require "code/in_out"
|
|||||||
-- classes
|
-- classes
|
||||||
require "code/point"
|
require "code/point"
|
||||||
require "code/rect"
|
require "code/rect"
|
||||||
require "code/chunk"
|
|
||||||
require "code/objects"
|
require "code/objects"
|
||||||
require "code/level"
|
require "code/level"
|
||||||
require "code/camera"
|
require "code/camera"
|
||||||
|
|||||||
42
data/levels/level1.lua
Normal file
42
data/levels/level1.lua
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
return {
|
||||||
|
name = "Dev Level",
|
||||||
|
tileset = tileset.library,
|
||||||
|
properties = {
|
||||||
|
darkness = false
|
||||||
|
},
|
||||||
|
tiles = {
|
||||||
|
{ 1, 4, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
||||||
|
{ 1, 4, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
||||||
|
{ 1, 4, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
||||||
|
{ 1, 4, 0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
||||||
|
{ 1, 4, 0, 0, 0, 2, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14},
|
||||||
|
{ 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
{ 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
{ 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
{ 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
{ 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
{ 1, 13, 13, 13, 13, 13, 13, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
{ 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
{ 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
{ 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
{ 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
{ 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
{ 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
{ 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
{ 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
{ 1, 1, 1, 1, 1, 1, 1, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13},
|
||||||
|
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
||||||
|
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
|
||||||
|
},
|
||||||
|
objects = {
|
||||||
|
spawns = {
|
||||||
|
{Fairy,{100,88}},
|
||||||
|
{HookAnchor,{200,89,100}},
|
||||||
|
{HookAnchor,{400,89,120}}
|
||||||
|
},
|
||||||
|
rooms = {
|
||||||
|
{{96,64},{544,320}},
|
||||||
|
{{0,0},{112,176}}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
|||||||
return {[ [[tileset]] ]=[[library]],[ [[chunks]] ]={[ 1 ]={[ 1 ]=[[global.lua]],},},[ [[name]] ]=[[unnamed]],[ [[properties]] ]={[ [[darkness]] ]=false,},}
|
|
||||||
Reference in New Issue
Block a user