🎨 Extended tilesets + UI icons
- 12 extended TSX tilesets (272 tiles) - 5 UI icons generated - Icon folder structure - Tool: generate_extended_tilesets.py
This commit is contained in:
79
tools/generate_extended_tilesets.py
Normal file
79
tools/generate_extended_tilesets.py
Normal file
@@ -0,0 +1,79 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Generate additional TSX tilesets for extended map design
|
||||
Uses images from mrtva_dolina/ collection
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
BASE_DIR = Path("/Users/davidkotnik/Desktop/novafarma")
|
||||
MRTVA_DOLINA = BASE_DIR / "mrtva_dolina"
|
||||
OUTPUT_DIR = BASE_DIR / "assets" / "maps" / "extended_tilesets"
|
||||
|
||||
# Create output directory
|
||||
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def create_collection_tileset(name, category, subcategory, pattern="*.png", max_tiles=30):
|
||||
"""Create a collection-based tileset from mrtva_dolina"""
|
||||
|
||||
source_dir = MRTVA_DOLINA / category / subcategory
|
||||
if not source_dir.exists():
|
||||
print(f"⚠️ Directory not found: {source_dir}")
|
||||
return None
|
||||
|
||||
files = sorted(list(source_dir.glob(pattern)))[:max_tiles]
|
||||
|
||||
if not files:
|
||||
print(f"⚠️ No files found for {name}")
|
||||
return None
|
||||
|
||||
# Create TSX content
|
||||
tsx_content = f"""<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tileset version="1.10" tiledversion="1.11.2" name="{name}" tilewidth="128" tileheight="128" tilecount="{len(files)}" columns="0">
|
||||
<grid orientation="orthogonal" width="1" height="1"/>
|
||||
"""
|
||||
|
||||
for idx, file in enumerate(files):
|
||||
rel_path = f"../../../mrtva_dolina/{category}/{subcategory}/{file.name}"
|
||||
tsx_content += f""" <tile id="{idx}">
|
||||
<image width="64" height="64" source="{rel_path}"/>
|
||||
</tile>
|
||||
"""
|
||||
|
||||
tsx_content += "</tileset>\n"
|
||||
|
||||
# Save
|
||||
tsx_path = OUTPUT_DIR / f"{name}.tsx"
|
||||
tsx_path.write_text(tsx_content)
|
||||
|
||||
print(f"✓ Created {name}.tsx ({len(files)} tiles)")
|
||||
return str(tsx_path)
|
||||
|
||||
print("🎨 Generating Extended Tilesets...\n")
|
||||
|
||||
# Characters
|
||||
create_collection_tileset("characters_players", "characters", "players", "*.png", 20)
|
||||
create_collection_tileset("characters_npcs", "characters", "npcs", "*.png", 30)
|
||||
create_collection_tileset("characters_zombies", "characters", "zombies", "*.png", 30)
|
||||
|
||||
# Creatures
|
||||
create_collection_tileset("creatures_animals", "creatures", "animals", "*.png", 25)
|
||||
create_collection_tileset("creatures_monsters", "creatures", "monsters", "*.png", 30)
|
||||
|
||||
# Buildings
|
||||
create_collection_tileset("buildings_ruins", "buildings", "ruins", "*.png", 20)
|
||||
create_collection_tileset("buildings_structures", "buildings", "structures", "*.png", 25)
|
||||
|
||||
# Terrain
|
||||
create_collection_tileset("terrain_water", "terrain", "water", "*water*.png", 15)
|
||||
create_collection_tileset("terrain_special", "terrain", "special", "*.png", 20)
|
||||
|
||||
# Vegetation
|
||||
create_collection_tileset("vegetation_plants", "vegetation", "plants", "*.png", 20)
|
||||
create_collection_tileset("vegetation_crops", "vegetation", "crops", "*.png", 25)
|
||||
|
||||
# Objects
|
||||
create_collection_tileset("objects_items", "objects", "items", "*.png", 30)
|
||||
create_collection_tileset("objects_furniture", "objects", "furniture", "*.png", 25)
|
||||
|
||||
print("\n✅ Done! Extended tilesets created in assets/maps/extended_tilesets/")
|
||||
Reference in New Issue
Block a user