diff --git a/src/data/maps/playground.lua b/src/data/maps/playground.lua new file mode 100644 index 0000000..32c56ac --- /dev/null +++ b/src/data/maps/playground.lua @@ -0,0 +1,187 @@ +return { + version = "1.9", + luaversion = "5.1", + tiledversion = "1.9.0", + class = "", + orientation = "orthogonal", + renderorder = "right-down", + width = 30, + height = 20, + tilewidth = 16, + tileheight = 16, + nextlayerid = 5, + nextobjectid = 4, + properties = {}, + tilesets = { + { + name = "roguelike-dungeon", + firstgid = 1, + filename = "../tilesets/roguelike-dungeon.tsx", + exportfilename = "../tilesets/roguelike-dungeon.lua" + } + }, + layers = { + { + type = "tilelayer", + x = 0, + y = 0, + width = 30, + height = 20, + id = 3, + name = "ground", + class = "", + visible = true, + opacity = 1, + offsetx = 0, + offsety = 0, + parallaxx = 1, + parallaxy = 1, + properties = {}, + encoding = "lua", + data = { + 484, 481, 485, 481, 485, 484, 484, 483, 484, 483, 481, 484, 481, 484, 485, 485, 482, 483, 483, 481, 485, 485, 483, 482, 481, 484, 484, 483, 485, 481, + 483, 481, 482, 481, 484, 484, 483, 481, 483, 485, 485, 482, 483, 482, 482, 484, 481, 481, 485, 485, 484, 481, 485, 483, 481, 485, 483, 481, 484, 482, + 482, 485, 485, 483, 483, 485, 481, 481, 484, 481, 483, 485, 482, 485, 484, 482, 485, 482, 482, 482, 484, 481, 485, 484, 484, 481, 482, 485, 482, 482, + 482, 483, 484, 482, 481, 485, 482, 481, 485, 483, 483, 483, 481, 481, 482, 483, 485, 481, 481, 485, 481, 484, 485, 484, 484, 484, 481, 482, 482, 481, + 485, 484, 484, 483, 483, 484, 485, 483, 482, 482, 484, 484, 484, 482, 482, 485, 485, 483, 483, 485, 484, 481, 484, 485, 481, 482, 485, 482, 482, 485, + 484, 483, 485, 481, 483, 483, 483, 484, 481, 485, 483, 482, 483, 483, 483, 483, 484, 481, 483, 485, 482, 485, 484, 482, 481, 482, 484, 481, 483, 481, + 483, 482, 483, 484, 481, 481, 483, 484, 485, 481, 482, 483, 483, 481, 483, 483, 482, 482, 484, 485, 484, 482, 482, 483, 484, 484, 483, 483, 483, 481, + 485, 482, 484, 482, 484, 482, 484, 484, 483, 481, 483, 484, 483, 481, 482, 481, 482, 485, 483, 482, 483, 481, 482, 481, 481, 484, 481, 482, 481, 481, + 481, 483, 482, 483, 481, 484, 481, 483, 484, 482, 483, 485, 483, 482, 485, 484, 481, 482, 481, 484, 483, 481, 484, 482, 482, 483, 483, 485, 481, 481, + 485, 483, 485, 482, 485, 483, 485, 481, 485, 482, 485, 483, 483, 482, 484, 483, 484, 483, 482, 484, 482, 481, 484, 483, 481, 484, 481, 485, 484, 485, + 483, 485, 483, 482, 483, 484, 484, 482, 484, 483, 483, 483, 484, 481, 483, 483, 483, 483, 481, 482, 482, 482, 481, 481, 483, 483, 481, 481, 484, 482, + 485, 485, 485, 481, 484, 484, 483, 482, 484, 482, 483, 485, 484, 482, 481, 484, 483, 482, 483, 483, 485, 485, 485, 484, 484, 484, 481, 485, 482, 484, + 484, 482, 482, 485, 483, 484, 485, 482, 481, 484, 485, 482, 484, 482, 481, 481, 481, 481, 484, 481, 485, 485, 483, 481, 483, 482, 482, 485, 484, 482, + 482, 481, 483, 485, 485, 485, 481, 483, 484, 481, 482, 483, 485, 483, 482, 485, 481, 485, 485, 483, 482, 484, 482, 483, 482, 485, 483, 482, 485, 481, + 481, 482, 485, 483, 482, 481, 481, 485, 481, 484, 485, 483, 485, 485, 484, 485, 482, 482, 484, 481, 484, 483, 483, 485, 485, 482, 485, 481, 483, 484, + 483, 483, 483, 482, 484, 484, 483, 485, 482, 484, 485, 482, 484, 483, 482, 485, 485, 484, 482, 485, 481, 481, 484, 485, 481, 482, 484, 485, 484, 483, + 483, 484, 481, 482, 482, 483, 485, 483, 483, 482, 481, 483, 483, 485, 484, 483, 484, 482, 485, 482, 485, 481, 485, 483, 485, 485, 481, 484, 483, 484, + 483, 484, 483, 481, 484, 484, 482, 481, 481, 482, 481, 482, 485, 484, 482, 484, 484, 483, 484, 484, 483, 483, 484, 485, 485, 485, 484, 485, 481, 482, + 481, 484, 484, 482, 483, 484, 482, 485, 485, 485, 481, 485, 485, 484, 481, 481, 483, 484, 484, 483, 481, 485, 481, 481, 484, 482, 485, 481, 482, 483, + 483, 485, 482, 481, 485, 483, 483, 482, 485, 483, 481, 484, 484, 485, 484, 484, 485, 484, 483, 483, 481, 483, 484, 484, 484, 485, 482, 483, 481, 482 + } + }, + { + type = "tilelayer", + x = 0, + y = 0, + width = 30, + height = 20, + id = 1, + name = "walls", + class = "", + visible = true, + opacity = 1, + offsetx = 0, + offsety = 0, + parallaxx = 1, + parallaxy = 1, + properties = {}, + encoding = "lua", + data = { + 13, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 45, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 14, + 41, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, + 41, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, + 41, 0, 0, 0, 10, 11, 43, 0, 0, 0, 0, 0, 0, 0, 0, 42, 11, 11, 11, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, + 41, 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, 41, + 41, 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, 41, + 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 11, 12, 0, 0, 0, 0, 41, + 41, 0, 0, 0, 0, 10, 11, 14, 0, 0, 0, 0, 0, 9, 0, 0, 0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0, 0, 0, 0, 0, 41, + 42, 11, 11, 11, 11, 11, 11, 11, 11, 11, 16, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 16, 11, 11, 11, 11, 11, 43 + } + }, + { + type = "tilelayer", + x = 0, + y = 0, + width = 30, + height = 20, + id = 4, + name = "decorations", + class = "", + visible = true, + opacity = 1, + offsetx = 0, + offsety = 0, + parallaxx = 1, + parallaxy = 1, + properties = {}, + encoding = "lua", + data = { + 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, 0, 0, 60, 61, 0, 0, 0, 66, 65, 0, 0, 0, 509, 0, 62, 0, 0, 478, 0, 0, 0, 0, 479, 0, 478, 0, 478, 0, + 0, 0, 480, 60, 0, 0, 0, 0, 0, 65, 65, 65, 480, 0, 0, 0, 505, 505, 505, 505, 505, 505, 505, 0, 0, 480, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 480, 0, 0, 65, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 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, 480, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 66, 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, 66, 66, 66, 0, 0, 0, 0, 0, 478, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 66, 0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0, 0, 0, 0 + } + }, + { + type = "objectgroup", + draworder = "topdown", + id = 2, + name = "spawnpoints", + class = "", + visible = true, + opacity = 1, + offsetx = 0, + offsety = 0, + parallaxx = 1, + parallaxy = 1, + properties = {}, + objects = { + { + id = 1, + name = "", + class = "", + shape = "point", + x = 67.3333, + y = 173.333, + width = 0, + height = 0, + rotation = 0, + visible = true, + properties = {} + }, + { + id = 2, + name = "", + class = "", + shape = "point", + x = 409.333, + y = 163.333, + width = 0, + height = 0, + rotation = 0, + visible = true, + properties = {} + } + } + } + } +} diff --git a/src/data/maps/playground.tmx b/src/data/maps/playground.tmx index 832fdc6..e3d5b61 100644 --- a/src/data/maps/playground.tmx +++ b/src/data/maps/playground.tmx @@ -1,31 +1,79 @@ - + - + - + + + +484,481,485,481,485,484,484,483,484,483,481,484,481,484,485,485,482,483,483,481,485,485,483,482,481,484,484,483,485,481, +483,481,482,481,484,484,483,481,483,485,485,482,483,482,482,484,481,481,485,485,484,481,485,483,481,485,483,481,484,482, +482,485,485,483,483,485,481,481,484,481,483,485,482,485,484,482,485,482,482,482,484,481,485,484,484,481,482,485,482,482, +482,483,484,482,481,485,482,481,485,483,483,483,481,481,482,483,485,481,481,485,481,484,485,484,484,484,481,482,482,481, +485,484,484,483,483,484,485,483,482,482,484,484,484,482,482,485,485,483,483,485,484,481,484,485,481,482,485,482,482,485, +484,483,485,481,483,483,483,484,481,485,483,482,483,483,483,483,484,481,483,485,482,485,484,482,481,482,484,481,483,481, +483,482,483,484,481,481,483,484,485,481,482,483,483,481,483,483,482,482,484,485,484,482,482,483,484,484,483,483,483,481, +485,482,484,482,484,482,484,484,483,481,483,484,483,481,482,481,482,485,483,482,483,481,482,481,481,484,481,482,481,481, +481,483,482,483,481,484,481,483,484,482,483,485,483,482,485,484,481,482,481,484,483,481,484,482,482,483,483,485,481,481, +485,483,485,482,485,483,485,481,485,482,485,483,483,482,484,483,484,483,482,484,482,481,484,483,481,484,481,485,484,485, +483,485,483,482,483,484,484,482,484,483,483,483,484,481,483,483,483,483,481,482,482,482,481,481,483,483,481,481,484,482, +485,485,485,481,484,484,483,482,484,482,483,485,484,482,481,484,483,482,483,483,485,485,485,484,484,484,481,485,482,484, +484,482,482,485,483,484,485,482,481,484,485,482,484,482,481,481,481,481,484,481,485,485,483,481,483,482,482,485,484,482, +482,481,483,485,485,485,481,483,484,481,482,483,485,483,482,485,481,485,485,483,482,484,482,483,482,485,483,482,485,481, +481,482,485,483,482,481,481,485,481,484,485,483,485,485,484,485,482,482,484,481,484,483,483,485,485,482,485,481,483,484, +483,483,483,482,484,484,483,485,482,484,485,482,484,483,482,485,485,484,482,485,481,481,484,485,481,482,484,485,484,483, +483,484,481,482,482,483,485,483,483,482,481,483,483,485,484,483,484,482,485,482,485,481,485,483,485,485,481,484,483,484, +483,484,483,481,484,484,482,481,481,482,481,482,485,484,482,484,484,483,484,484,483,483,484,485,485,485,484,485,481,482, +481,484,484,482,483,484,482,485,485,485,481,485,485,484,481,481,483,484,484,483,481,485,481,481,484,482,485,481,482,483, +483,485,482,481,485,483,483,482,485,483,481,484,484,485,484,484,485,484,483,483,481,483,484,484,484,485,482,483,481,482 + + -1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1, -1,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, -1,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, -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2147483649,2147483649,2147483649,0,0,0,0,1, -1,0,0,0,0,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,2147483649,2147483649,0,0,0,0,0,0,1, -1,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,2147483649,0,0,0,0,0,0,0,1, -1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,2147483649,0,0,0,0,0,0,0,1, -1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,2147483649,0,0,0,0,0,0,0,1, -1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,2147483649,0,0,0,0,0,0,0,1, -1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,2147483649,2147483649,0,0,0,0,0,0,1, -1,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,2147483649,2147483649,2147483649,0,0,0,0,1, -1,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1, -1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1, -1,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,0,0,1, -1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1, -1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1, -1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1 +13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,45,11,11,11,11,11,11,11,11,11,11,11,11,11,14, +41,0,0,0,0,0,41,0,0,0,0,0,0,0,0,41,0,0,0,0,0,0,0,0,0,0,0,0,0,41, +41,0,0,0,0,0,41,0,0,0,0,0,0,0,0,41,0,0,0,0,0,0,0,0,0,0,0,0,0,41, +41,0,0,0,10,11,43,0,0,0,0,0,0,0,0,42,11,11,11,12,0,0,0,0,0,0,0,0,0,41, +41,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,41, +41,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,41, +41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,11,12,0,0,0,0,41, +41,0,0,0,0,10,11,14,0,0,0,0,0,9,0,0,0,0,0,0,0,13,43,0,0,0,0,0,0,41, +41,0,0,0,0,0,0,42,14,0,0,0,0,41,0,0,0,0,0,0,0,41,0,0,0,0,0,0,0,41, +41,0,0,0,0,0,0,0,41,0,0,0,0,41,0,0,0,0,0,0,0,41,0,0,0,0,0,0,0,41, +41,0,0,0,0,0,0,0,41,0,0,0,0,41,0,0,0,0,0,0,0,41,0,0,0,0,0,0,0,41, +41,0,0,0,0,0,0,0,41,0,0,0,0,41,0,0,0,0,0,0,0,41,0,0,0,0,0,0,0,41, +41,0,0,0,0,0,0,0,41,0,0,0,0,41,0,0,0,9,0,0,0,42,14,0,0,0,0,0,0,41, +41,0,0,0,0,0,0,13,43,0,0,0,0,38,0,0,0,41,0,0,0,0,42,11,12,0,0,0,0,41, +41,0,0,0,0,10,11,43,0,0,0,0,0,0,0,0,0,41,0,0,0,0,0,0,0,0,0,0,0,41, +41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,0,0,0,0,0,0,0,0,0,0,0,41, +41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,11,11,12,0,0,41, +41,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,41,0,0,0,0,0,41, +41,0,0,0,0,0,0,0,0,0,41,0,0,0,0,0,0,0,0,0,0,0,0,41,0,0,0,0,0,41, +42,11,11,11,11,11,11,11,11,11,16,11,11,11,11,11,11,11,11,11,11,11,11,16,11,11,11,11,11,43 + + + + +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,0,0,60,61,0,0,0,66,65,0,0,0,509,0,62,0,0,478,0,0,0,0,479,0,478,0,478,0, +0,0,480,60,0,0,0,0,0,65,65,65,480,0,0,0,505,505,505,505,505,505,505,0,0,480,0,0,0,0, +0,0,0,0,0,0,0,0,0,65,65,65,0,0,0,0,0,0,0,0,0,0,480,0,0,65,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,66,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,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,66,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,66,66,66,0,0,0,0,0,478,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,66,0,66,0,0,479,478,0,0,0,0,0,0, +0,0,480,0,0,0,0,422,0,0,0,0,0,0,0,0,0,0,0,0,0,0,478,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,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,0,0,0, +0,65,65,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,478,478,0,0,0,0,0, +0,65,65,65,0,0,0,0,0,0,0,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,65,65,65,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,65,0,0,0,0,66,66,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,483,0,0,66,66,0,0,0,0,0,65,65,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,478,479,505,505,505,505,505,505,0,0,0,0,0,0,0,65,65,65,480,0,0,0,0,451,0,0,0,0,0, +0,478,478,478,0,0,0,0,0,0,0,479,479,478,0,0,0,0,0,0,0,0,509,0,0,0,0,478,478,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 diff --git a/src/data/maps/test.lua b/src/data/maps/test.lua deleted file mode 100644 index 5226fda..0000000 --- a/src/data/maps/test.lua +++ /dev/null @@ -1,107 +0,0 @@ -return { - version = "1.9", - luaversion = "5.1", - tiledversion = "1.9.0", - class = "", - orientation = "orthogonal", - renderorder = "right-down", - width = 30, - height = 20, - tilewidth = 16, - tileheight = 16, - nextlayerid = 3, - nextobjectid = 3, - properties = {}, - tilesets = { - { - name = "test", - firstgid = 1, - filename = "../tilesets/test.tsx", - exportfilename = "../tilesets/test.lua" - } - }, - layers = { - { - type = "tilelayer", - x = 0, - y = 0, - width = 30, - height = 20, - id = 1, - name = "walls", - class = "", - visible = true, - opacity = 1, - offsetx = 0, - offsety = 0, - parallaxx = 1, - parallaxy = 1, - properties = {}, - encoding = "lua", - data = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 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, 0, 0, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 - } - }, - { - type = "objectgroup", - draworder = "topdown", - id = 2, - name = "spawnpoints", - class = "", - visible = true, - opacity = 1, - offsetx = 0, - offsety = 0, - parallaxx = 1, - parallaxy = 1, - properties = {}, - objects = { - { - id = 1, - name = "", - class = "", - shape = "point", - x = 67.3333, - y = 173.333, - width = 0, - height = 0, - rotation = 0, - visible = true, - properties = {} - }, - { - id = 2, - name = "", - class = "", - shape = "point", - x = 409.333, - y = 163.333, - width = 0, - height = 0, - rotation = 0, - visible = true, - properties = {} - } - } - } - } -} diff --git a/src/data/maps/test.tmx b/src/data/maps/test.tmx deleted file mode 100644 index 5402b5d..0000000 --- a/src/data/maps/test.tmx +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - -1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1, -1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,0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,1,1,1,1,1,1 - - - - diff --git a/src/data/sprites/bolt.aseprite b/src/data/sprites/bolt.aseprite index ac62429..0cfec69 100644 Binary files a/src/data/sprites/bolt.aseprite and b/src/data/sprites/bolt.aseprite differ diff --git a/src/data/tilesets/roguelike-dungeon.lua b/src/data/tilesets/roguelike-dungeon.lua new file mode 100644 index 0000000..d0476e9 --- /dev/null +++ b/src/data/tilesets/roguelike-dungeon.lua @@ -0,0 +1,128 @@ +return { + version = "1.9", + luaversion = "5.1", + tiledversion = "1.9.0", + name = "roguelike-dungeon", + class = "", + tilewidth = 16, + tileheight = 16, + spacing = 1, + margin = 0, + columns = 29, + image = "roguelike-dungeon.png", + imagewidth = 492, + imageheight = 305, + objectalignment = "unspecified", + tilerendersize = "tile", + fillmode = "stretch", + tileoffset = { + x = 0, + y = 0 + }, + grid = { + orientation = "orthogonal", + width = 16, + height = 16 + }, + properties = {}, + wangsets = {}, + tilecount = 522, + tiles = { + { + id = 8, + properties = { + ["collidable"] = true + } + }, + { + id = 9, + properties = { + ["collidable"] = true + } + }, + { + id = 10, + properties = { + ["collidable"] = true + } + }, + { + id = 11, + properties = { + ["collidable"] = true + } + }, + { + id = 12, + properties = { + ["collidable"] = true + } + }, + { + id = 13, + properties = { + ["collidable"] = true + } + }, + { + id = 14, + properties = { + ["collidable"] = true + } + }, + { + id = 15, + properties = { + ["collidable"] = true + } + }, + { + id = 37, + properties = { + ["collidable"] = true + } + }, + { + id = 38, + properties = { + ["collidable"] = true + } + }, + { + id = 39, + properties = { + ["collidable"] = true + } + }, + { + id = 40, + properties = { + ["collidable"] = true + } + }, + { + id = 41, + properties = { + ["collidable"] = true + } + }, + { + id = 42, + properties = { + ["collidable"] = true + } + }, + { + id = 43, + properties = { + ["collidable"] = true + } + }, + { + id = 44, + properties = { + ["collidable"] = true + } + } + } +} diff --git a/src/data/tilesets/roguelike-dungeon.png b/src/data/tilesets/roguelike-dungeon.png new file mode 100644 index 0000000..5d1bc64 Binary files /dev/null and b/src/data/tilesets/roguelike-dungeon.png differ diff --git a/src/data/tilesets/roguelike-dungeon.tsx b/src/data/tilesets/roguelike-dungeon.tsx new file mode 100644 index 0000000..fa54a7f --- /dev/null +++ b/src/data/tilesets/roguelike-dungeon.tsx @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/data/tilesets/roguelike-indoors.png b/src/data/tilesets/roguelike-indoors.png new file mode 100644 index 0000000..c6046fd Binary files /dev/null and b/src/data/tilesets/roguelike-indoors.png differ diff --git a/src/data/tilesets/roguelike-indoors.tsx b/src/data/tilesets/roguelike-indoors.tsx new file mode 100644 index 0000000..f611edd --- /dev/null +++ b/src/data/tilesets/roguelike-indoors.tsx @@ -0,0 +1,4 @@ + + + + diff --git a/src/data/tilesets/test.aseprite b/src/data/tilesets/test.aseprite deleted file mode 100644 index 8e85aa9..0000000 Binary files a/src/data/tilesets/test.aseprite and /dev/null differ diff --git a/src/data/tilesets/test.lua b/src/data/tilesets/test.lua deleted file mode 100644 index 8db211e..0000000 --- a/src/data/tilesets/test.lua +++ /dev/null @@ -1,38 +0,0 @@ -return { - version = "1.9", - luaversion = "5.1", - tiledversion = "1.9.0", - name = "test", - class = "", - tilewidth = 16, - tileheight = 16, - spacing = 0, - margin = 0, - columns = 6, - image = "test.png", - imagewidth = 96, - imageheight = 96, - objectalignment = "unspecified", - tilerendersize = "tile", - fillmode = "stretch", - tileoffset = { - x = 0, - y = 0 - }, - grid = { - orientation = "orthogonal", - width = 16, - height = 16 - }, - properties = {}, - wangsets = {}, - tilecount = 36, - tiles = { - { - id = 0, - properties = { - ["collidable"] = true - } - } - } -} diff --git a/src/data/tilesets/test.png b/src/data/tilesets/test.png deleted file mode 100644 index 1404b98..0000000 Binary files a/src/data/tilesets/test.png and /dev/null differ diff --git a/src/data/tilesets/test.tsx b/src/data/tilesets/test.tsx deleted file mode 100644 index 0fac7ec..0000000 --- a/src/data/tilesets/test.tsx +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/src/lib/sti/plugins/bump.lua b/src/lib/sti/plugins/bump.lua index 905f5f2..aeb0e81 100644 --- a/src/lib/sti/plugins/bump.lua +++ b/src/lib/sti/plugins/bump.lua @@ -14,17 +14,20 @@ local function getKeys(t) return keys end --- The highest 4 bits in 32bit tile ids are used for marking if that tile is --- flipped, so to get the real id, you first need to remove those bits using --- this mask. local bit = require("bit") -local GID_MASK = bit.bnot(bit.lshift(15, 28)) +local FLIPPED_HORIZONTALLY_FLAG = 0x80000000; +local FLIPPED_VERTICALLY_FLAG = 0x40000000; +local FLIPPED_DIAGONALLY_FLAG = 0x20000000; +local ROTATED_HEXAGONAL_120_FLAG = 0x10000000; +local GID_MASK = bit.bnot(bit.bor(FLIPPED_DIAGONALLY_FLAG, FLIPPED_VERTICALLY_FLAG, FLIPPED_HORIZONTALLY_FLAG, ROTATED_HEXAGONAL_120_FLAG)) -local function findTileFromTilesets(tilesets, gid) +local function findTileFromTilesets(tilesets, id) for _, tileset in ipairs(tilesets) do - for _, tile in ipairs(tileset.tiles) do - if tileset.firstgid + tile.id == gid then - return tile + if tileset.firstgid <= id then + for _, tile in ipairs(tileset.tiles) do + if tileset.firstgid + tile.id == id then + return tile + end end end end @@ -46,59 +49,61 @@ return { local id = bit.band(gid, GID_MASK) local tile = findTileFromTilesets(map.tilesets, id) - for _, instance in ipairs(map.tileInstances[gid]) do - -- Every object in every instance of a tile - if tile.objectGroup then - for _, object in ipairs(tile.objectGroup.objects) do - if object.properties.collidable == true then - local t = { - name = object.name, - type = object.type, - x = instance.x + map.offsetx + object.x, - y = instance.y + map.offsety + object.y, - width = object.width, - height = object.height, - layer = instance.layer, - properties = object.properties - } + if tile then + for _, instance in ipairs(map.tileInstances[gid]) do + -- Every object in every instance of a tile + if tile.objectGroup then + for _, object in ipairs(tile.objectGroup.objects) do + if object.properties.collidable == true then + local t = { + name = object.name, + type = object.type, + x = instance.x + map.offsetx + object.x, + y = instance.y + map.offsety + object.y, + width = object.width, + height = object.height, + layer = instance.layer, + properties = object.properties + } - world:add(t, t.x, t.y, t.width, t.height) - table.insert(collidables, t) + world:add(t, t.x, t.y, t.width, t.height) + table.insert(collidables, t) + end end end - end - -- Every instance of a tile - if tile.properties and tile.properties.collidable == true then - local tileProperties = map.tiles[gid] - local x = instance.x + map.offsetx - local y = instance.y + map.offsety - local sx = tileProperties.sx - local sy = tileProperties.sy + -- Every instance of a tile + if tile.properties and tile.properties.collidable == true then + local tileProperties = map.tiles[gid] + local x = instance.x + map.offsetx + local y = instance.y + map.offsety + local sx = tileProperties.sx + local sy = tileProperties.sy - -- Width and height can only be positive in bump, to get around this - -- For negative scaling just move the position back instead - if sx < 1 then - sx = -sx - x = x - map.tilewidth * sx + -- Width and height can only be positive in bump, to get around this + -- For negative scaling just move the position back instead + if sx < 1 then + sx = -sx + x = x - map.tilewidth * sx + end + if sy < 1 then + sy = -sy + x = x - map.tileheight * sy + end + + local t = { + x = x, + y = y, + width = map.tilewidth * sx, + height = map.tileheight * sy, + layer = instance.layer, + type = tile.type, + properties = tile.properties + } + + world:add(t, t.x, t.y, t.width, t.height) + table.insert(collidables, t) end - if sy < 1 then - sy = -sy - x = x - map.tileheight * sy - end - - local t = { - x = x, - y = y, - width = map.tilewidth * sx, - height = map.tileheight * sy, - layer = instance.layer, - type = tile.type, - properties = tile.properties - } - - world:add(t, t.x, t.y, t.width, t.height) - table.insert(collidables, t) end end end diff --git a/src/systems/map.lua b/src/systems/map.lua index 99409e1..7206043 100644 --- a/src/systems/map.lua +++ b/src/systems/map.lua @@ -3,7 +3,7 @@ local sti = require("lib.sti") local Vector = require("lib.brinevector") function Map:init() - self.map = sti("data/maps/test.lua", { "bump" }) + self.map = sti("data/maps/playground.lua", { "bump" }) self.pool:emit("onMapSwitch", self.map) end diff --git a/src/systems/sprite.lua b/src/systems/sprite.lua index 9aecfe6..727ebd6 100644 --- a/src/systems/sprite.lua +++ b/src/systems/sprite.lua @@ -2,9 +2,6 @@ local data = require("data") local pprint = require("lib.pprint") local Sprite = {} --- TODO: Maybe add a texture atlas library for packing frame data --- TODO: For production maybe use another type of loader? (https://github.com/elloramir/packer, https://github.com/EngineerSmith/Runtime-TextureAtlas) - function Sprite:addToWorld(group, e) if group ~= "sprite" then return end