Created
January 6, 2024 18:49
-
-
Save GamingasCZ/7e2805b6435de1ca3ae45cb4e271b16c to your computer and use it in GitHub Desktop.
This code generates a file with offsets and sizes of Geometry Dash cubes :D.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, plistlib, json | |
plists = list(filter(lambda x: x.endswith(".plist"), os.listdir())) | |
icons = {} | |
for icon in plists: | |
with open(icon, "rb") as f: | |
xml = plistlib.load(f, fmt=plistlib.FMT_XML)["frames"] | |
for key, value in xml.items(): | |
icons[key] = { | |
"spriteOffset": [int(float(i)) for i in value["spriteOffset"][1:-1].split(",")], | |
"spriteSize": [int(float(i)) for i in value["spriteSize"][1:-1].split(",")] | |
} | |
with open("offsets.json", "w") as f: | |
json.dump(icons, f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment