fix depth sorting for world objects by tileY

Fixes #31. All trees, rocks, seedlings and buildings now use
tileY+5 as depth instead of a fixed value, so objects further
down the screen always render in front of objects above them
regardless of spawn order. Build ghost moved to depth 1000/1001.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-23 19:40:27 +00:00
parent 87f69b4774
commit cd171c859c
4 changed files with 9 additions and 8 deletions

View File

@@ -110,7 +110,7 @@ export class TreeSeedlingSystem {
const key = `seedling_${Math.min(s.stage, 2)}`
const sprite = this.scene.add.image(x, y, key)
.setOrigin(0.5, 0.85)
.setDepth(5)
.setDepth(s.tileY + 5)
this.sprites.set(s.id, sprite)
}