-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_map.py
More file actions
41 lines (38 loc) · 855 Bytes
/
make_map.py
File metadata and controls
41 lines (38 loc) · 855 Bytes
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
from PIL import Image
import json
img = Image.open('map/map_dirt.png').convert('1')
rawData = img.load()
data = {}
block_base = {}
i = 0
for y in range(55):
for x in range(55):
if rawData[x,y] == 0:
block_base[str(i)] = {
'x' : x - 28,
'y' : 0,
'z' : y - 28
}
i += 1
for y in range(55):
for x in range(55):
if rawData[x,y] == 0:
block_base[str(i)] = {
'x' : x - 28,
'y' : 0,
'z' : (200/.35641) + y - 28
}
i += 1
for y in range(55):
for x in range(55):
if rawData[x,y] == 0:
block_base[str(i)] = {
'x' : x - 28,
'y' : 0,
'z' : -(200/.35641) + y - 28
}
i += 1
data['block_base'] = block_base
with open('data.json', 'w') as f:
json.dump(data, f)
#print(block_base)