aboutsummaryrefslogtreecommitdiff
path: root/tools/map.py
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-07-11 16:10:48 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-07-11 16:11:17 +0100
commit4c993daaaf87ff6c5dc87479f6a23ec342e91ee6 (patch)
tree20cd6e197b02a79741879194157069d358391848 /tools/map.py
parent5f6c4b946aaa4da8668ea153f2fef2dde91b8e58 (diff)
downloadgold-mine-run-4c993daaaf87ff6c5dc87479f6a23ec342e91ee6.tar.gz
gold-mine-run-4c993daaaf87ff6c5dc87479f6a23ec342e91ee6.zip
Sort the entities by y coord
Diffstat (limited to 'tools/map.py')
-rwxr-xr-xtools/map.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/map.py b/tools/map.py
index 6c18e82..ca189e3 100755
--- a/tools/map.py
+++ b/tools/map.py
@@ -68,7 +68,10 @@ def main():
entity_layer = get_layer(data, "Entities")
- for ent in entity_layer["objects"]:
+ # some entities will never change their y coordinate, so sorting them by y
+ # should help the drawing order in the game
+ objs_sorted = sorted(entity_layer["objects"], key=lambda o: o["y"])
+ for ent in objs_sorted:
try:
typ = entity_types.index(ent["name"])
except ValueError: