From b87245927e08887af7746ce0f7a91d3f73af0572 Mon Sep 17 00:00:00 2001 From: davidovski Date: Mon, 10 Jul 2023 00:29:01 +0100 Subject: cleanup project --- tools/createmap.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 tools/createmap.py (limited to 'tools') diff --git a/tools/createmap.py b/tools/createmap.py new file mode 100755 index 0000000..59fb315 --- /dev/null +++ b/tools/createmap.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python +import sys + +outfile = "map.tiles" + +WIDTH = 500 +HEIGHT = 100 +# number of bytes each tile needs to represent +TILEBYTES = 25 + +HEADER = "TILEFILEv1" + +with open(outfile, "wb") as file: + file.write(bytes(HEADER, "ascii")) + file.write(WIDTH.to_bytes(4, 'big')); + file.write(HEIGHT.to_bytes(4, 'big')); + file.write(TILEBYTES.to_bytes(4, 'big')); + + for y in range(HEIGHT): + for x in range(WIDTH): + index = (x + y) % 5 + file.write(index.to_bytes(TILEBYTES, 'big')); + -- cgit v1.2.1