From 70894db948bb051e689a4b4172d519a967df115f Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 24 Apr 2024 04:56:44 +0200 Subject: [PATCH] tbh `GoldDisplay` is a better name --- scenes/game/cursor.gd | 2 +- scenes/game/cursor.tscn | 4 ++-- scenes/game/{gold_counter.gd => gold_display.gd} | 2 +- scenes/game/{gold_counter.tscn => gold_display.tscn} | 6 +++--- scenes/game/main_game.gd | 5 +++-- 5 files changed, 10 insertions(+), 9 deletions(-) rename scenes/game/{gold_counter.gd => gold_display.gd} (92%) rename scenes/game/{gold_counter.tscn => gold_display.tscn} (91%) diff --git a/scenes/game/cursor.gd b/scenes/game/cursor.gd index 35d791d..406f8dd 100644 --- a/scenes/game/cursor.gd +++ b/scenes/game/cursor.gd @@ -9,7 +9,7 @@ signal dropped(node: Draggable) @onready var game: MainGame = MainGame.get_via_group(self) -@onready var gold_counter: GoldCounter = %"GoldCounter" +@onready var gold_display: GoldDisplay = %"GoldDisplay" var dragging: Draggable = null diff --git a/scenes/game/cursor.tscn b/scenes/game/cursor.tscn index 81f0942..7925ead 100644 --- a/scenes/game/cursor.tscn +++ b/scenes/game/cursor.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=3 uid="uid://col1q3elvkfwk"] [ext_resource type="Script" path="res://scenes/game/cursor.gd" id="1_1og6v"] -[ext_resource type="PackedScene" uid="uid://cu750c7yd57qa" path="res://scenes/game/gold_counter.tscn" id="2_ofjhi"] +[ext_resource type="PackedScene" uid="uid://cu750c7yd57qa" path="res://scenes/game/gold_display.tscn" id="2_5c4iq"] [sub_resource type="CircleShape2D" id="CircleShape2D_j2mj5"] radius = 4.0 @@ -16,5 +16,5 @@ script = ExtResource("1_1og6v") shape = SubResource("CircleShape2D_j2mj5") debug_color = Color(1, 1, 1, 1) -[node name="GoldCounter" parent="." instance=ExtResource("2_ofjhi")] +[node name="GoldDisplay" parent="." instance=ExtResource("2_5c4iq")] unique_name_in_owner = true diff --git a/scenes/game/gold_counter.gd b/scenes/game/gold_display.gd similarity index 92% rename from scenes/game/gold_counter.gd rename to scenes/game/gold_display.gd index f277d4a..9f13463 100644 --- a/scenes/game/gold_counter.gd +++ b/scenes/game/gold_display.gd @@ -1,5 +1,5 @@ extends PanelContainer -class_name GoldCounter +class_name GoldDisplay @onready var label: Label = %"Label" diff --git a/scenes/game/gold_counter.tscn b/scenes/game/gold_display.tscn similarity index 91% rename from scenes/game/gold_counter.tscn rename to scenes/game/gold_display.tscn index 575d9b4..0079322 100644 --- a/scenes/game/gold_counter.tscn +++ b/scenes/game/gold_display.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=6 format=3 uid="uid://cu750c7yd57qa"] -[ext_resource type="Script" path="res://scenes/game/gold_counter.gd" id="1_koxhc"] +[ext_resource type="Script" path="res://scenes/game/gold_display.gd" id="1_yhouw"] [sub_resource type="Animation" id="Animation_3gb4u"] resource_name = "RESET" @@ -40,12 +40,12 @@ _data = { [sub_resource type="LabelSettings" id="LabelSettings_1jb4h"] -[node name="GoldCounter" type="PanelContainer"] +[node name="GoldDisplay" type="PanelContainer"] offset_left = 16.0 offset_top = 24.0 offset_right = 56.0 offset_bottom = 51.0 -script = ExtResource("1_koxhc") +script = ExtResource("1_yhouw") [node name="Animator" type="AnimationPlayer" parent="."] unique_name_in_owner = true diff --git a/scenes/game/main_game.gd b/scenes/game/main_game.gd index 3881b08..446acd5 100644 --- a/scenes/game/main_game.gd +++ b/scenes/game/main_game.gd @@ -16,6 +16,7 @@ static func get_via_group(node: Node) -> MainGame: func _ready(): + # Set up the gold display var gold_counter = inventory.get_counter(&"Gold") - gold_counter.changed.connect(cursor.gold_counter.display.unbind(1)) - cursor.gold_counter.set_text(gold_counter.value) + gold_counter.changed.connect(cursor.gold_display.display.unbind(1)) + cursor.gold_display.set_text(gold_counter.value)