Skip to content

Commit

Permalink
Remove inventory button and created a gold label (#142)
Browse files Browse the repository at this point in the history
* removed the button to access the inventory and added a label to show gold amount
  • Loading branch information
Biosquid authored Dec 27, 2024
1 parent fca8bb6 commit ac4807f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
17 changes: 16 additions & 1 deletion #Scenes/TopBarOverlay.tscn
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
[gd_scene load_steps=7 format=3 uid="uid://bam77cwf4emyr"]
[gd_scene load_steps=9 format=3 uid="uid://bam77cwf4emyr"]

[ext_resource type="Texture2D" uid="uid://cjlatwiw7r80d" path="res://Art/Map/icon.png" id="1_a5uhs"]
[ext_resource type="Script" path="res://UI/InventoryButton.gd" id="1_ml7tf"]
[ext_resource type="Script" path="res://UI/MapButton.gd" id="2_72rkb"]
[ext_resource type="Texture2D" uid="uid://cw0ojfpapsf3a" path="res://Art/Map/inventory_icon.png" id="2_j3m2f"]
[ext_resource type="Texture2D" uid="uid://hqkt8t1v2f5h" path="res://Art/Card_layout/deck_pile.png" id="3_87q1i"]
[ext_resource type="Script" path="res://UI/DeckPileUISetter.gd" id="4_jtp2y"]
[ext_resource type="Script" path="res://UI/GoldLabel.gd" id="7_dey8e"]

[sub_resource type="LabelSettings" id="LabelSettings_khmn7"]
font_size = 24

[node name="TopBarOverlay" type="Control"]
layout_mode = 3
Expand All @@ -18,6 +22,7 @@ grow_horizontal = 2
grow_vertical = 2

[node name="Inventory" type="TextureButton" parent="."]
visible = false
layout_mode = 0
offset_left = 560.0
offset_top = 18.0
Expand Down Expand Up @@ -68,4 +73,14 @@ texture_focused = ExtResource("3_87q1i")
stretch_mode = 0
script = ExtResource("4_jtp2y")

[node name="Gold" type="Label" parent="."]
layout_mode = 0
offset_left = 504.0
offset_top = 33.0
offset_right = 627.0
offset_bottom = 67.0
text = "Gold: 1000"
label_settings = SubResource("LabelSettings_khmn7")
script = ExtResource("7_dey8e")

[connection signal="pressed" from="Inventory" to="Inventory" method="_on_pressed"]
10 changes: 10 additions & 0 deletions UI/GoldLabel.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends Label
## Gold counter display in the top right. Should handle updates when gold changes

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
update_gold_text(InventoryManager.gold_component.get_gold_amount())
InventoryManager.gold_component.gold_changed.connect(update_gold_text)

func update_gold_text(new_gold_amount : int) -> void:
text = "Gold : " + str(new_gold_amount)

0 comments on commit ac4807f

Please sign in to comment.