1
0
Fork 0

Sort by absolute position

This commit is contained in:
Pabloader 2026-05-05 11:27:34 +00:00
parent 0c10347c78
commit 7956d2bb51
1 changed files with 3 additions and 1 deletions

View File

@ -22,7 +22,9 @@ export class TextDisplaySystem extends System {
y: viewport.worldY - viewport.screenY,
} : { x: 0, y: 0 };
const sprites = Array.from(world.query(Sprite, Position)).sort((a, b) => a[2].state.z - b[2].state.z);
const sprites = Array.from(world.query(Sprite, Position))
.sort((a, b) => Number(a[2].absolute) - Number(b[2].absolute) || a[2].z - b[2].z);
for (const [e, sprite, pos] of sprites) {
if (e.has(Hidden)) continue;
const image = sprite.image;