From 29d8a93ece4c0107c98d63ab8a422cf732fd304c Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Sun, 27 Apr 2025 18:07:18 +0200 Subject: [PATCH] Refactor HUD and marketplace layout for improved responsiveness and usability --- objects/hud.tscn | 6 +++--- objects/marketplace.tscn | 2 +- scenes/test.tscn | 7 +------ scripts/marketplace.gd | 5 +++-- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/objects/hud.tscn b/objects/hud.tscn index a198646..202aa01 100644 --- a/objects/hud.tscn +++ b/objects/hud.tscn @@ -32,7 +32,6 @@ health_progressbar = NodePath("Panel/PanelContainer/ProgressBar") lives_label = NodePath("Panel/PanelContainer/Lives") [node name="Panel" type="Panel" parent="."] -custom_minimum_size = Vector2(0, 16) layout_mode = 1 anchors_preset = 10 anchor_right = 1.0 @@ -42,10 +41,11 @@ theme_override_styles/panel = SubResource("StyleBoxFlat_aa3sf") [node name="PanelContainer" type="HBoxContainer" parent="Panel"] layout_mode = 1 -anchors_preset = 10 +anchors_preset = 15 anchor_right = 1.0 -offset_bottom = 16.0 +anchor_bottom = 1.0 grow_horizontal = 2 +grow_vertical = 2 theme_override_constants/separation = 10 [node name="Health Label" type="Label" parent="Panel/PanelContainer"] diff --git a/objects/marketplace.tscn b/objects/marketplace.tscn index 1ae926a..8a2683b 100644 --- a/objects/marketplace.tscn +++ b/objects/marketplace.tscn @@ -55,4 +55,4 @@ layout_mode = 2 size_flags_vertical = 3 theme_override_constants/h_separation = 8 theme_override_constants/v_separation = 8 -columns = 3 +columns = 2 diff --git a/scenes/test.tscn b/scenes/test.tscn index 25c5283..9f09ae5 100644 --- a/scenes/test.tscn +++ b/scenes/test.tscn @@ -482,13 +482,8 @@ position = Vector2(877, -577) [node name="HUD" parent="CanvasLayer" instance=ExtResource("1_gbpkv")] [node name="Marketplace" parent="CanvasLayer" node_paths=PackedStringArray("root", "skill_unlocker") instance=ExtResource("20_ss8k0")] -visible = false custom_minimum_size = Vector2(480, 240) -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 +offset_top = 16.0 root = NodePath(".") skill_unlocker = NodePath("../../Brick Player/SkillUnlockerComponent") diff --git a/scripts/marketplace.gd b/scripts/marketplace.gd index 5902a7a..fbb0a0c 100644 --- a/scripts/marketplace.gd +++ b/scripts/marketplace.gd @@ -38,10 +38,11 @@ func create_upgrade_button(skill: SkillData): button.text = skill.name + " " + str(skill.cost) button.flat = true button.icon = skill.icon - + button.pressed.connect(func () -> void: _on_button_pressed(skill)) grid.add_child(button) + grid.queue_sort() func remove_button(skill: SkillData): @@ -58,4 +59,4 @@ func _on_button_pressed(skill: SkillData) -> void: if skill_unlocker.try_unlock_skill(skill): print("Skill unlocked: ", skill.name) remove_button(skill) - \ No newline at end of file +