comparison tools/build.py @ 19:3a831478eda4

adjusted tower pivot and angle definitions to better match scribbled assets
author ark
date 2026-10-20 00:36 +0200
parents fe680946164b
children ad1b478fc4dc
comparison
equal deleted inserted replaced
18:5dc69898a091 19:3a831478eda4
507 507
508 # 8. previews 508 # 8. previews
509 509
510 def step_previews(cfg, maps, force, changed): 510 def step_previews(cfg, maps, force, changed):
511 outputs = [PREVIEW / f"map{m}.png" for m in range(MAPS)] + [PREVIEW / "towers.png"] 511 outputs = [PREVIEW / f"map{m}.png" for m in range(MAPS)] + [PREVIEW / "towers.png"]
512 # the tower sheet shows the pivots, footprint and sprite scale from game.toml 512 # the tower sheet shows the angles, pivots, footprint and sprite scale from game.toml
513 if not changed and not stale([CONFIG / "game.toml"], outputs, force): 513 if not changed and not stale([CONFIG / "game.toml"], outputs, force):
514 print("previews: up to date") 514 print("previews: up to date")
515 return 515 return
516 PREVIEW.mkdir(parents=True, exist_ok=True) 516 PREVIEW.mkdir(parents=True, exist_ok=True)
517 for m, mp in enumerate(maps): 517 for m, mp in enumerate(maps):
518 preview.map_preview(ART / f"map{m}.png", mp).save(PREVIEW / f"map{m}.png") 518 preview.map_preview(ART / f"map{m}.png", mp).save(PREVIEW / f"map{m}.png")
519 if len(mp["routes"]) > 1: 519 if len(mp["routes"]) > 1:
520 preview.route_sheet(ART / f"map{m}.png", mp).save(PREVIEW / f"map{m}_routes.png") 520 preview.route_sheet(ART / f"map{m}.png", mp).save(PREVIEW / f"map{m}_routes.png")
521 preview.tower_sheet(ASSETS, cfg["art"]["pivot"], cfg["placement"]["footprint_radius"], 521 preview.tower_sheet(ASSETS, cfg["art"]["angle"], cfg["art"]["pivot"],
522 cfg["placement"]["footprint_radius"],
522 cfg["scale"]["sprite"]).save(PREVIEW / "towers.png") 523 cfg["scale"]["sprite"]).save(PREVIEW / "towers.png")
523 print(f"previews: wrote {PREVIEW.relative_to(ROOT)}/") 524 print(f"previews: wrote {PREVIEW.relative_to(ROOT)}/")
524 525
525 526
526 # 9. game files 527 # 9. game files