Skip to content

Instantly share code, notes, and snippets.

@GamingasCZ
Created January 6, 2024 18:49
Show Gist options
  • Save GamingasCZ/7e2805b6435de1ca3ae45cb4e271b16c to your computer and use it in GitHub Desktop.
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.
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