summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2021-01-02 21:09:42 +0000
committerJuan J. Martinez <jjm@usebox.net>2021-01-02 21:09:42 +0000
commit86a391103d9b262bdd881ce32af9f13e7c2d8e25 (patch)
treefa8c72e9807d562a0323b585a6aa856c82ec291a
parente2462f8cd44c0bd786c9df5d0d922517be966405 (diff)
downloadubox-msx-lib-86a391103d9b262bdd881ce32af9f13e7c2d8e25.tar.gz
ubox-msx-lib-86a391103d9b262bdd881ce32af9f13e7c2d8e25.zip
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.
-rwxr-xr-xtools/map.py6
1 files 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")