Nisse silhouette outline when occluded by world objects #33

Closed
opened 2026-03-23 19:46:58 +00:00 by claude · 0 comments
Collaborator

Problem

After Y-based depth sorting (#31), Nisse sprites correctly sort with trees and buildings — but this means a Nisse behind a tree becomes completely invisible.

Solution

Give each Nisse a second "outline" sprite that is always rendered above all world objects:

  • outlineSprite: same texture, scaled 1.3×, white fill (setTintFill(0xffffff)), alpha 0.7, depth 900
  • Main sprite depth: dynamic per frame = floor(y / TILE_SIZE) + 5 (Y-sorted with world objects)
  • Name label / energy bar / job icon: moved to depth 901/902 (always readable)

Behaviour

  • Nisse in front of tree: normal sprite covers silhouette → subtle white border visible
  • Nisse behind tree: normal sprite occluded → white silhouette shows through the tree

Depth layout after this change

Layer Depth
Stockpile zone 4
Trees, rocks, seedlings, buildings tileY + 5 (5–517)
Nisse normal sprite floor(y/TILE_SIZE) + 5
Nisse silhouette 900
Nisse UI (label, bar, icon) 901–902
Build ghost 1000/1001
## Problem After Y-based depth sorting (#31), Nisse sprites correctly sort with trees and buildings — but this means a Nisse behind a tree becomes completely invisible. ## Solution Give each Nisse a second "outline" sprite that is always rendered above all world objects: - `outlineSprite`: same texture, scaled 1.3×, white fill (`setTintFill(0xffffff)`), alpha 0.7, depth 900 - Main sprite depth: dynamic per frame = `floor(y / TILE_SIZE) + 5` (Y-sorted with world objects) - Name label / energy bar / job icon: moved to depth 901/902 (always readable) ### Behaviour - Nisse in front of tree: normal sprite covers silhouette → subtle white border visible - Nisse behind tree: normal sprite occluded → white silhouette shows through the tree ## Depth layout after this change | Layer | Depth | |-------|-------| | Stockpile zone | 4 | | Trees, rocks, seedlings, buildings | tileY + 5 (5–517) | | Nisse normal sprite | floor(y/TILE_SIZE) + 5 | | Nisse silhouette | 900 | | Nisse UI (label, bar, icon) | 901–902 | | Build ghost | 1000/1001 |
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: tekki/nissefolk#33
No description provided.