diff tools/build.py @ 6:910b26feca76

full game flow
author ark
date 2026-10-19 01:05 +0200
parents 2d46729a022e
children 2c4fed8baed9
line wrap: on
line diff
--- a/tools/build.py	Sun Oct 18 22:50:24 2026 +0200
+++ b/tools/build.py	Mon Oct 19 01:05:29 2026 +0200
@@ -48,8 +48,12 @@
 SPRITES = (["m%d" % i for i in range(5)] + ["b%d" % i for i in range(4)]
            + ["t%d" % i for i in range(4)] + ["p%d" % i for i in range(4)]
            + ["c%d" % i for i in range(4)] + ["hpm", "hpb"])
-# empty part of an hp bar: a darkened copy (art.md)
+# hp bar variants (art.md): the empty part is a darkened copy, the bar of a
+# slowed monster has its colour set to this hue in degrees
 BAR_DARKEN = 0.35
+BAR_SLOW_HUE = 220
+BARS = ["hpm", "hpb"]
+BAR_VARIANTS = [f"{n}{v}" for n in BARS for v in ("_empty", "_slow", "_slow_empty")]
 MAPS = 4
 MAP_QUALITY = 88
 # centre line smoothing: moving average half window, simplify tolerance
@@ -87,7 +91,7 @@
 
 def step_sprites(force):
     inputs = [ART / f"{n}.png" for n in SPRITES]
-    outputs = [ASSETS / f"{n}.png" for n in SPRITES] + [ASSETS / "hpm_empty.png", ASSETS / "hpb_empty.png"]
+    outputs = [ASSETS / f"{n}.png" for n in SPRITES + BAR_VARIANTS]
     if not stale(inputs, outputs, force):
         print("sprites: up to date")
         return False
@@ -95,9 +99,12 @@
     for n in SPRITES:
         im = images.trim(Image.open(ART / f"{n}.png").convert("RGBA"))
         im.save(ASSETS / f"{n}.png", optimize=True)
-        if n in ("hpm", "hpb"):
+        if n in BARS:
+            slow = images.recolour(im, BAR_SLOW_HUE)
             images.darken(im, BAR_DARKEN).save(ASSETS / f"{n}_empty.png", optimize=True)
-    print(f"sprites: wrote {len(SPRITES)} sprites and 2 empty bars")
+            slow.save(ASSETS / f"{n}_slow.png", optimize=True)
+            images.darken(slow, BAR_DARKEN).save(ASSETS / f"{n}_slow_empty.png", optimize=True)
+    print(f"sprites: wrote {len(SPRITES)} sprites and {len(BAR_VARIANTS)} bar variants")
     return True