From 86a391103d9b262bdd881ce32af9f13e7c2d8e25 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sat, 2 Jan 2021 21:09:42 +0000 Subject: Flicker friendly sorting of entities It may not make a big difference if entities can move vertically freely, but in some cases may be better. --- tools/map.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/map.py b/tools/map.py index 5c6e27e..c2e2212 100755 --- a/tools/map.py +++ b/tools/map.py @@ -200,8 +200,10 @@ def main(): parser.error("max_bytes: no 'bytes' found for %r" % name) try: - objs = sorted( - entities_layer["objects"], key=lambda o: et_names.index(o["name"].lower())) + objs = entities_layer["objects"] + objs.sort(key=lambda o: o["y"]) + objs.sort(key=lambda o: o["x"]) + objs.sort(key=lambda o: et_names.index(o["name"].lower())) except ValueError: parser.error("map has an unnamed object") -- cgit v1.2.3