Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
f2776db0eThis file is pinned to the selected release. Download the original to open it in your design tool.
#!/usr/bin/env python3
from xml.dom import minidom
import sys
if len(sys.argv) != 3:
sys.exit("Usage: tmx2bin <tmx map file> <binary output file>")
bindata = bytearray()
doc = minidom.parse(sys.argv[1])
csvdata = doc.getElementsByTagName("data")[0].firstChild.data
for line in csvdata.strip().split("\n"):
for tilenum in line.strip(",").split(","):
bindata.append(int(tilenum) - 1)
open(sys.argv[2], "wb").write(bindata)