aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAstatin <[email protected]>2024-08-11 17:52:09 +0900
committerAstatin <astatin@redacted>2024-08-11 17:52:09 +0900
commit865aa6689a7372b7453b41fba6c5b787c72843d7 (patch)
tree2be0e08ba079f6955f8d909a273aebe2c666a98e /scripts
parenta33a0c0e334bec1a8db48c81eae809e2eb7bc9ec (diff)
Make leaf tiles depend on surrounding tiles
Diffstat (limited to 'scripts')
-rw-r--r--scripts/parse_sprite_png.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/parse_sprite_png.py b/scripts/parse_sprite_png.py
index 1fcc4ab..49889fc 100644
--- a/scripts/parse_sprite_png.py
+++ b/scripts/parse_sprite_png.py
@@ -7,8 +7,13 @@ file = Image.open(sys.argv[1]).convert("RGB")
px_array = np.asarray(file)
def getpx(sprite_nb, x, y):
- sprite_line = int(sprite_nb / (file.width / 8))
- sprite_column = int(sprite_nb % (file.width / 8))
+ double_sprite_nb = int(sprite_nb / 4)
+ sprite_double_line = int(double_sprite_nb / (file.width / 16))
+ sprite_double_column = int(double_sprite_nb % (file.width / 16))
+ sprite_tile_y = 1 if sprite_nb & 0b10 else 0
+ sprite_tile_x = 1 if sprite_nb & 0b01 else 0
+ sprite_line = sprite_double_line * 2 + sprite_tile_y
+ sprite_column = sprite_double_column * 2 + sprite_tile_x
return [int(x) for x in px_array[int(sprite_line * 8 + y)][int(sprite_column * 8 + x)]]
@@ -36,6 +41,10 @@ for nb in range(0, sprite_nb):
if abs(db) < min(abs(dw), abs(dlg), abs(ddg)):
print("#", end = '')
+ if abs(ddg) < min(abs(dw), abs(dlg), abs(db)):
+ print(";", end = '')
+ if abs(dlg) < min(abs(dw), abs(ddg), abs(db)):
+ print(".", end = '')
else:
print(" ", end = '')
print("\n", end = '')