From 09b96360f8ed1a6269661f9ed78210416828ef69 Mon Sep 17 00:00:00 2001 From: Bryce Date: Sun, 26 Apr 2026 21:51:16 -0700 Subject: [PATCH] fix: wire backpack signals and simplify positioning - Connect overlay_show_requested/overlay_hide_requested signals in Game.tscn to new handlers in MainGame.gd that call show_overlay()/hide_overlay() - Simplify backpack to fixed 70x70 position at top-left (layout_mode=0) - Remove broken anchor overrides from Game.tscn that were anchoring to bottom --- Game.tscn | 12 +++--------- MainGame.gd | 6 ++++++ inventory/inventory_backpack/InventoryBackpack.tscn | 7 ++----- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Game.tscn b/Game.tscn index 5e37d51..bf7114e 100644 --- a/Game.tscn +++ b/Game.tscn @@ -190,17 +190,11 @@ autowrap_mode = 3 layer = 5 [node name="InventoryBackpack" parent="HUD" unique_id=-294967294 instance=ExtResource("9_backpack")] -anchors_preset = 12 -anchor_top = 1.0 -anchor_bottom = 1.0 -offset_top = -64.65503 -offset_bottom = -4.654907 -grow_vertical = 0 [node name="InventoryOverlayLayer" type="CanvasLayer" parent="." unique_id=-294967293] layer = 10 -visible = false [node name="InventoryOverlay" parent="InventoryOverlayLayer" unique_id=-294967292 instance=ExtResource("a_overlay")] -grow_horizontal = 2 -grow_vertical = 2 + +[connection signal="overlay_show_requested" from="HUD/InventoryBackpack" to="HUD/InventoryBackpack/.." method="_on_backpack_show_overlay"] +[connection signal="overlay_hide_requested" from="HUD/InventoryBackpack" to="HUD/InventoryBackpack/.." method="_on_backpack_hide_overlay"] diff --git a/MainGame.gd b/MainGame.gd index 6cdd7e1..9e3aed3 100644 --- a/MainGame.gd +++ b/MainGame.gd @@ -74,6 +74,12 @@ func restore_cursor() -> void: func _unhandled_input(event: InputEvent) -> void: $SceneViewport.push_input(event) +func _on_backpack_show_overlay() -> void: + $HUD/InventoryOverlay.show_overlay() + +func _on_backpack_hide_overlay() -> void: + $HUD/InventoryOverlay.hide_overlay() + func _input(event): if event.is_action_released("quit"): get_tree().quit() diff --git a/inventory/inventory_backpack/InventoryBackpack.tscn b/inventory/inventory_backpack/InventoryBackpack.tscn index 3128bd5..2380fa8 100644 --- a/inventory/inventory_backpack/InventoryBackpack.tscn +++ b/inventory/inventory_backpack/InventoryBackpack.tscn @@ -3,11 +3,8 @@ [ext_resource type="Script" uid="uid://2x3g0ethsdcgo" path="res://inventory/inventory_backpack/InventoryBackpack.gd" id="1"] [node name="InventoryBackpack" type="Control" unique_id=1000000001] -layout_mode = 3 -anchors_preset = 2 -anchor_right = 1.0 -offset_top = 10.0 -offset_right = -70.0 +layout_mode = 0 +offset_right = 70.0 offset_bottom = 70.0 script = ExtResource("1")