import cv2 import numpy as np import os def create_tileset(): # Paths grass_path = 'main/assets/tla_trava_tekstura.png' water_path = 'main/assets/stream_water.png' output_path = 'main/assets/ground_tileset.png' # Load images grass = cv2.imread(grass_path, cv2.IMREAD_UNCHANGED) water = cv2.imread(water_path, cv2.IMREAD_UNCHANGED) if grass is None: print(f"Error: Could not load {grass_path}") return if water is None: print(f"Error: Could not load {water_path}") return # Check dimensions # Assuming tiles are 256x256 based on previous instructions # We will resize if necessary but ideally they match print(f"Grass shape: {grass.shape}") print(f"Water shape: {water.shape}") # Ensure 4 channels if grass.shape[2] == 3: grass = cv2.cvtColor(grass, cv2.COLOR_BGR2BGRA) if water.shape[2] == 3: water = cv2.cvtColor(water, cv2.COLOR_BGR2BGRA) # Force resize to 256x256 if not (just to be safe for the tilesource) grass = cv2.resize(grass, (256, 256)) water = cv2.resize(water, (256, 256)) # Combine horizontally (Tile 1, Tile 2) # Tilesource indexing usually starts at 1 # So Tile 1 = Grass, Tile 2 = Water tileset = np.hstack((grass, water)) cv2.imwrite(output_path, tileset) print(f"Created tileset at {output_path} with shape {tileset.shape}") if __name__ == "__main__": create_tileset()