|
@@ -15,11 +15,12 @@ def set_gid_in_layer(layer, x, y, gid):
|
|
|
def update_tiled_json(source_json, tiled_template):
|
|
|
for item in source_json['LevelData']:
|
|
|
x, y, z = item['X'], item['Y'], item['Z']
|
|
|
- if z < 10:
|
|
|
- layer_name = f"Tile_{z}"
|
|
|
- layer = next((l for l in tiled_template['layers'] if l['name'] == layer_name), None)
|
|
|
- if layer:
|
|
|
- set_gid_in_layer(layer, x, y, 1)
|
|
|
+ layer_name = f"Tile_{z}"
|
|
|
+ layer = next((l for l in tiled_template['layers'] if l['name'] == layer_name), None)
|
|
|
+ if layer:
|
|
|
+ set_gid_in_layer(layer, x, y, 1)
|
|
|
+ else:
|
|
|
+ print(f"Layer {layer_name} not found")
|
|
|
|
|
|
marks_layer = next((l for l in tiled_template['layers'] if l['name'] == "Marks"), None)
|
|
|
if marks_layer:
|
|
@@ -55,7 +56,7 @@ os.chdir(script_dir)
|
|
|
# Example usage
|
|
|
source_dir = '/Users/xulianxin/Documents/develop/game/TileMatch/TileManor.Lv/TileFamily/level_data2'
|
|
|
target_dir = '../tf_templates'
|
|
|
-template_file = '../templates/0000-template.json'
|
|
|
+template_file = './0000-template.json'
|
|
|
process_files(source_dir, target_dir, template_file)
|
|
|
|
|
|
os.chdir(current_dir)
|