From 6b326173287cd5ac8da3a68f99048533d3ca2991 Mon Sep 17 00:00:00 2001 From: megaproxy Date: Sat, 16 May 2026 15:28:49 +0100 Subject: [PATCH] Pawn sprite: show_behind_parent fix for invisible bodies z_index=-1 was sinking the sprite below the floor TileMap (z=0), so name labels rendered but bodies didn't. Using show_behind_parent=true keeps the sprite at z=0 (above floor) while still drawing BEFORE the parent's _draw() so selection ring + carry indicator overlay on top. --- scenes/pawn/pawn.gd | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scenes/pawn/pawn.gd b/scenes/pawn/pawn.gd index 7010ade..b9f7ba0 100644 --- a/scenes/pawn/pawn.gd +++ b/scenes/pawn/pawn.gd @@ -251,7 +251,11 @@ func _mount_sprite() -> void: _sprite.sprite_frames = sf _sprite.centered = true _sprite.offset = Vector2(0, -8) # bottom-anchor: feet ≈ tile bottom edge - _sprite.z_index = -1 + # show_behind_parent lets the sprite render at the same z_index as the + # parent Pawn (so it stays above the floor TileMap), while ALSO drawing + # beneath the parent's _draw() callback — so selection ring + carry + # indicator overlay on top. z_index=-1 would sink below the floor too. + _sprite.show_behind_parent = true _sprite.play(&"idle_down") add_child(_sprite) Audit.log("pawn_sprite", "%s → atlas idx %d" % [pawn_name, (absi(pawn_name.hash()) % _PEASANT_COUNT) + 1])