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.
This commit is contained in:
megaproxy 2026-05-16 15:28:49 +01:00
parent 326fd84b90
commit 6b32617328

View file

@ -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])