diff --git a/assets/maps/base_farm.tmx b/assets/maps/base_farm.tmx index c975c55d..1e999786 100644 --- a/assets/maps/base_farm.tmx +++ b/assets/maps/base_farm.tmx @@ -6,8 +6,11 @@ - - + + + + + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, diff --git a/assets/maps/farm_tilesets/farm_buildings.tsx b/assets/maps/farm_tilesets/farm_buildings.tsx new file mode 100644 index 00000000..96f89c48 --- /dev/null +++ b/assets/maps/farm_tilesets/farm_buildings.tsx @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/maps/farm_tilesets/farm_fences.tsx b/assets/maps/farm_tilesets/farm_fences.tsx new file mode 100644 index 00000000..18190073 --- /dev/null +++ b/assets/maps/farm_tilesets/farm_fences.tsx @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/maps/farm_tilesets/farm_grass.tsx b/assets/maps/farm_tilesets/farm_grass.tsx new file mode 100644 index 00000000..ae2dc44a --- /dev/null +++ b/assets/maps/farm_tilesets/farm_grass.tsx @@ -0,0 +1,4 @@ + + + + diff --git a/assets/maps/farm_tilesets/farm_soil.tsx b/assets/maps/farm_tilesets/farm_soil.tsx new file mode 100644 index 00000000..364ab15a --- /dev/null +++ b/assets/maps/farm_tilesets/farm_soil.tsx @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/assets/maps/farm_tilesets/farm_trees.tsx b/assets/maps/farm_tilesets/farm_trees.tsx new file mode 100644 index 00000000..726c62ba --- /dev/null +++ b/assets/maps/farm_tilesets/farm_trees.tsx @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/generate_farm_tilesets.py b/tools/generate_farm_tilesets.py new file mode 100644 index 00000000..165acc3d --- /dev/null +++ b/tools/generate_farm_tilesets.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python3 +""" +Generate TSX tilesets for Base Farm from mrtva_dolina collection +""" + +import os +from pathlib import Path + +BASE_DIR = Path("/Users/davidkotnik/Desktop/novafarma") +MRTVA_DOLINA = BASE_DIR / "mrtva_dolina" +OUTPUT_DIR = BASE_DIR / "assets" / "maps" / "farm_tilesets" + +# Create output directory +OUTPUT_DIR.mkdir(parents=True, exist_ok=True) + +def create_ground_tileset(): + """Create grass/ground tileset""" + # Find grass tiles + ground_dir = MRTVA_DOLINA / "terrain" / "ground" + grass_files = [f for f in ground_dir.glob("*grass*.png")] + + if not grass_files: + print("⚠️ No grass files found, using first available") + grass_files = list(ground_dir.glob("*.png"))[:1] + + if grass_files: + grass_file = grass_files[0] + + # Create TSX for grass + tsx_content = f""" + + + +""" + + tsx_path = OUTPUT_DIR / "farm_grass.tsx" + with open(tsx_path, 'w') as f: + f.write(tsx_content) + + print(f"✓ Created farm_grass.tsx") + return str(tsx_path) + + return None + +def create_collection_tileset(category, subcategory, name, pattern="*.png", max_tiles=20): + """Create collection-based tileset""" + + source_dir = MRTVA_DOLINA / category / subcategory + files = list(source_dir.glob(pattern))[:max_tiles] + + if not files: + print(f"⚠️ No files found for {name}") + return None + + tsx_content = f""" + + +""" + + for idx, file in enumerate(files): + rel_path = f"../../../mrtva_dolina/{category}/{subcategory}/{file.name}" + tsx_content += f""" + + +""" + + tsx_content += "\n" + + tsx_path = OUTPUT_DIR / f"{name}.tsx" + with open(tsx_path, 'w') as f: + f.write(tsx_content) + + print(f"✓ Created {name}.tsx ({len(files)} tiles)") + return str(tsx_path) + +# Generate tilesets +print("🎨 Generating Base Farm Tilesets...\n") + +create_ground_tileset() +create_collection_tileset("buildings", "houses", "farm_buildings", "*house*.png", 10) +create_collection_tileset("vegetation", "trees", "farm_trees", "*.png", 15) +create_collection_tileset("buildings", "structures", "farm_fences", "*fence*.png", 10) +create_collection_tileset("terrain", "ground", "farm_soil", "*soil*.png", 5) + +print("\n✅ Done! Tilesets created in assets/maps/farm_tilesets/")