-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapWriter.lua
49 lines (42 loc) · 1.66 KB
/
mapWriter.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
json = require 'json4lua/json/json'
mapData = {
tiles = {
{3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2},
{3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2},
{3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2},
{3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2},
{3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2},
{3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2},
{3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2},
{3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2},
{3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2},
{3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2},
{3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2},
{3,2,1,1,1,22,1,1,1,1,1,1,1,1,1,1,1,1,3,2},
{3,2,3,2,3,2,1,1,3,2,3,2,3,2,3,2,3,2,3,2},
{3,2,1,18,16,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2},
{3,2,1,19,14,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2},
{3,2,1,19,17,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2},
{3,2,1,20,15,1,1,1,1,1,1,1,1,1,1,1,1,1,3,2},
{3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2},
{21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21},
{21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21}
},
portals = {
{16,5,0,16,6}
},
objects = {
tree = { sprites = {2,3}, passable = false, class = 'env', interactable = false },
grass = {sprites = {1}, passable = true, class = 'env', interactable = false},
building = { sprites = {14,15,16,18,19,20}, passable = false, class = 'env', interactable = false },
door = {sprites = {17}, passable = true, portal = true, class = 'env', interactable = false},
sign = {sprites = {22}, passable = false, portal = false, message = "Hello world!", interactable = true, class = 'talk'}
}
}
out = json.encode(mapData)
--io.input("test0")
--out = io.read("*all")
print(out)
res = json.decode(out)
io.output("maps/map1.json")
io.write(out)