From 4c993daaaf87ff6c5dc87479f6a23ec342e91ee6 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Tue, 11 Jul 2023 16:10:48 +0100 Subject: Sort the entities by y coord --- tools/map.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools') 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: -- cgit v1.2.3