Fix Y-based depth sorting for world objects #32

Merged
tekki merged 5 commits from feature/depth-sorting into master 2026-03-23 20:07:28 +00:00
Collaborator

Fixes #31.

What changed

  • Trees, rocks, seedlings: depth = tileY + 5 (was fixed 5)
  • Health bars: depth = tileY + 6 (was fixed 6)
  • Buildings (chest, bed, forester hut): depth = tileY + 5 (was fixed 8)
  • Build ghost / label: depth 1000/1001 (was 20/21) so they always render on top

Objects further down the screen now always render in front of objects above them, regardless of spawn order.

Fixes #31. ## What changed - Trees, rocks, seedlings: depth = tileY + 5 (was fixed 5) - Health bars: depth = tileY + 6 (was fixed 6) - Buildings (chest, bed, forester hut): depth = tileY + 5 (was fixed 8) - Build ghost / label: depth 1000/1001 (was 20/21) so they always render on top Objects further down the screen now always render in front of objects above them, regardless of spawn order.
claude added 1 commit 2026-03-23 19:41:50 +00:00
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>
claude added 1 commit 2026-03-23 19:47:55 +00:00
Fixes #33. Each Nisse now has a white filled outline sprite at depth 900
that is always visible above trees and buildings. The main sprite uses
Y-based depth (floor(y/TILE_SIZE)+5) so Nisse sort correctly with world
objects. Name label, energy bar and job icon moved to depth 901/902 so
they remain readable regardless of occlusion.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
claude added 1 commit 2026-03-23 19:52:43 +00:00
Silhouette now hidden by default and toggled on per frame only when
isOccluded() detects a tree, rock or building 1–3 tiles below the Nisse.
Adds WorldSystem.hasResourceAt() for O(1) tile lookup. Outline colour
changed to light blue (0xaaddff) at scale 1.1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
claude added 1 commit 2026-03-23 20:02:46 +00:00
Expands isOccluded() from same-column-only to a 3x4 tile window
(tileX+-1, tileY+1..4) to catch trees whose canopy extends sideways
and well above the trunk tile. Outline scale bumped to 1.15.
claude added 1 commit 2026-03-23 20:05:59 +00:00
Depth fixed at 900; isOccluded() and outlineSprite removed.
WorldSystem.hasResourceAt() stays as a useful utility.
tekki approved these changes 2026-03-23 20:07:20 +00:00
tekki merged commit 08dffa135f into master 2026-03-23 20:07:28 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: tekki/nissefolk#32
No description provided.