diff --git a/.godot/editor/create_recent.Node b/.godot/editor/create_recent.Node index 1ed6f8b4cc80dd9ef4288e8ffc3bb1d426919bed..027464d80804ce35f9cb2b1fc76080e3fdcb6937 100644 --- a/.godot/editor/create_recent.Node +++ b/.godot/editor/create_recent.Node @@ -1,14 +1,14 @@ -Node +Label +Button +TextureRect Node2D +Node Control AnimationPlayer ColorRect CanvasLayer VBoxContainer -TextureRect Sprite2D Panel -Button RichTextLabel -Label HBoxContainer diff --git a/.godot/editor/editor_layout.cfg b/.godot/editor/editor_layout.cfg index 0a541933bffc28f37837e3028fc111beae410223..224c5e2e0cd4d188e573347396751a1957c099b7 100644 --- a/.godot/editor/editor_layout.cfg +++ b/.godot/editor/editor_layout.cfg @@ -2,7 +2,7 @@ dock_3_selected_tab_idx=0 dock_4_selected_tab_idx=0 -dock_5_selected_tab_idx=0 +dock_5_selected_tab_idx=1 dock_floating={} dock_bottom=[] dock_closed=[] @@ -10,33 +10,33 @@ dock_split_2=0 dock_split_3=0 dock_hsplit_1=0 <<<<<<<HEADdock_hsplit_2=498 -dock_hsplit_3=-270 -dock_hsplit_2=270 +dock_hsplit_3=-290 +dock_hsplit_2=306 dock_hsplit_4=0 dock_filesystem_h_split_offset=240 dock_filesystem_v_split_offset=0 dock_filesystem_display_mode=0 dock_filesystem_file_sort=0 dock_filesystem_file_list_display_mode=1 -dock_filesystem_selected_paths=PackedStringArray("res://main.tscn") -dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://") +dock_filesystem_selected_paths=PackedStringArray("res://scenes/Shop.tscn") +dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://", "res://scenes/") dock_3="Scene,Import" dock_4="FileSystem" dock_5="Inspector,Node,History" [EditorNode] -open_scenes=PackedStringArray("res://scenes/game.tscn", "res://main.tscn") -current_scene="res://main.tscn" -center_split_offset=-468 -selected_default_debugger_tab_idx=1 +open_scenes=PackedStringArray("res://scenes/game.tscn", "res://main.tscn", "res://scenes/Shop.tscn") +current_scene="res://scenes/Shop.tscn" +center_split_offset=-252 +selected_default_debugger_tab_idx=0 selected_main_editor_idx=2 -selected_bottom_panel_item=1 +selected_bottom_panel_item=0 [ScriptEditor] -open_scripts=["res://README.md"] -selected_script="res://README.md" +open_scripts=["res://scripts/game.gd", "res://README.md", "res://scripts/Shop.gd"] +selected_script="res://scripts/Shop.gd" open_help=[] script_split_offset=70 list_split_offset=0 diff --git a/.godot/editor/filesystem_cache8 b/.godot/editor/filesystem_cache8 index dfb89cf92b491f4c5553a0556446364c213cb2d8..d97e4c9a4b26db1d19d02459aba8f280f75edd4e 100644 --- a/.godot/editor/filesystem_cache8 +++ b/.godot/editor/filesystem_cache8 @@ -1,13 +1,15 @@ ea4bc82a6ad023ab7ee23ee620429895 -::res://::1738707328 +::res://::1738955541 +export_presets.cfg::TextFile::-1::1738780181::0::1::::<><>:: icon.svg::CompressedTexture2D::6378281210119878262::1737912187::1738338716::1::::<><>:: -main.tscn::PackedScene::5692118487183161714::1738707261::0::1::::<><>::uid://cu7lkx15lmfww::::res://scenes/scene_manager.tscn +main.tscn::PackedScene::5692118487183161714::1738955360::0::1::::<><>::uid://cu7lkx15lmfww::::res://scenes/scene_manager.tscn README.md::TextFile::-1::1737912187::0::1::::<><>:: +Shop.tscn::PackedScene::6176556733226555776::1738955541::0::1::::<><>::res://scripts/Shop.gd ::res://assets/::1738358720 -::res://assets/noise/::1738707289 -noise2.tres::NoiseTexture2D::5054739835828921764::1738707289::0::1::::<><>:: -noise3.tres::NoiseTexture2D::906885015046579772::1738707289::0::1::::<><>:: -noise.tres::NoiseTexture2D::1693764769519573005::1738707289::0::1::::<><>:: +::res://assets/noise/::1738954380 +noise2.tres::NoiseTexture2D::5054739835828921764::1738954380::0::1::::<><>:: +noise3.tres::NoiseTexture2D::906885015046579772::1738954380::0::1::::<><>:: +noise.tres::NoiseTexture2D::1693764769519573005::1738954380::0::1::::<><>:: ::res://assets/Original size Chess pieces/::1738707284 Black king piece 2.png::CompressedTexture2D::7820367427145083060::1738358720::1738707284::1::::<><>:: Black knight piece.png::CompressedTexture2D::4196515762256027844::1738358720::1738707284::1::::<><>:: @@ -38,9 +40,9 @@ White_Pawn.png::CompressedTexture2D::919180529085242722::1738358720::1738707285: White_Queen.png::CompressedTexture2D::4902137832695542513::1738358720::1738707285::1::::<><>:: White_rook.png::CompressedTexture2D::4194129281780453908::1738358720::1738707285::1::::<><>:: White_wizard.png::CompressedTexture2D::8734158881343267537::1738707261::1738707285::1::::<><>:: -::res://assets/shaders/::1738707289 +::res://assets/shaders/::1738954380 3d_effect.gdshader::Shader::-1::1738707261::0::1::::<><>:: -bg.gdshader::Shader::-1::1738707289::0::1::::<><>:: +bg.gdshader::Shader::-1::1738954380::0::1::::<><>:: color.gdshader::Shader::-1::1738378229::0::1::::<><>:: shadow.gdshader::Shader::-1::1738378229::0::1::::<><>:: ::res://assets/sprites/::1738707284 @@ -77,11 +79,11 @@ Mockup Shop Design.jpg::CompressedTexture2D::8043055154093708922::1738358720::17 play_button.png::CompressedTexture2D::5896995890187459238::1738707261::1738707284::1::::<><>:: quit_button.png::CompressedTexture2D::5172428563227279585::1738707261::1738707284::1::::<><>:: rules_button.png::CompressedTexture2D::8060955005205795067::1738707261::1738707284::1::::<><>:: -::res://scenes/::1738707289 +::res://scenes/::1738955453 Assassin.tscn::PackedScene::1241611789899982875::1738377694::0::1::::<><>::res://scripts/Assassin.gd<>uid://753dogr1moxe::::res://assets/temp_assets/assassin.png Bishop.tscn::PackedScene::2789588702038144760::1738377693::0::1::::<><>::res://scripts/Bishop.gd<>uid://b68o4mj7wcwvq::::res://assets/sprites/bishop.png explosion.tscn::PackedScene::69466253159940830::1738377693::0::1::::<><>:: -game.tscn::PackedScene::8577524005707705072::1738707289::0::1::::<><>::res://scripts/game.gd<>res://assets/shaders/bg.gdshader<>uid://yeqb8ndri7xp::::res://assets/noise/noise.tres<>uid://ceas3dsjeq4ge::::res://assets/noise/noise2.tres<>uid://m6ki73qfbp2s::::res://assets/noise/noise3.tres +game.tscn::PackedScene::8577524005707705072::1738955453::0::1::::<><>::res://scripts/game.gd<>res://assets/shaders/bg.gdshader<>uid://yeqb8ndri7xp::::res://assets/noise/noise.tres<>uid://ceas3dsjeq4ge::::res://assets/noise/noise2.tres<>uid://m6ki73qfbp2s::::res://assets/noise/noise3.tres King.tscn::PackedScene::8277830396459966414::1738377693::0::1::::<><>::res://scripts/King.gd<>uid://cdogixbq8ay3t::::res://assets/Resized Chess Piece Assets/White_king.png Knight.tscn::PackedScene::5270730075267457303::1738377694::0::1::::<><>::res://scripts/Knight.gd<>uid://mf4a3jclbwih::::res://assets/Resized Chess Piece Assets/White_knight.png Mage.tscn::PackedScene::10334063134713649::1738377694::0::1::::<><>::res://scripts/Mage.gd<>uid://b7iyt4iwjbtd0::::res://assets/temp_assets/mage.png @@ -94,18 +96,19 @@ title_screen.tscn::PackedScene::8154710134031658440::1738707261::0::1::::<><>::r Wizard.tscn::PackedScene::6352212773395470747::1738377694::0::1::::<><>::res://scripts/Wizard.gd<>uid://bfk1j3brcknkp::::res://assets/temp_assets/wizard.png ::res://scenes/ui/::1738707261 menu_button.tscn::PackedScene::3297943059633979218::1738707261::0::1::::<><>::res://assets/shaders/3d_effect.gdshader<>res://scripts/title_screen/menu_button.gd -::res://scripts/::1738707261 +::res://scripts/::1738955541 Assassin.gd::GDScript::-1::1738373911::0::1::::Assassin<>Piece<>:: Bishop.gd::GDScript::-1::1738376561::0::1::::Bishop<>Piece<>:: -game.gd::GDScript::-1::1738377789::0::1::::game<>Node<>:: +game.gd::GDScript::-1::1738955443::0::1::::game<>Node<>:: King.gd::GDScript::-1::1738373926::0::1::::King<>Piece<>:: Knight.gd::GDScript::-1::1738375042::0::1::::Knight<>Piece<>:: Mage.gd::GDScript::-1::1738373960::0::1::::Mage<>Piece<>:: -Pawn.gd::GDScript::-1::1738373968::0::1::::Pawn<>Piece<>:: +Pawn.gd::GDScript::-1::1738953951::0::1::::Pawn<>Piece<>:: Piece.gd::GDScript::-1::1738376307::0::1::::Piece<>Node2D<>:: Queen.gd::GDScript::-1::1738373933::0::1::::Queen<>Piece<>:: Rook.gd::GDScript::-1::1738373976::0::1::::Rook<>Piece<>:: scene_manager.gd::GDScript::-1::1738707261::0::1::::<>Node<>:: +Shop.gd::GDScript::-1::1738955422::0::1::::<>Node2D<>:: Wizard.gd::GDScript::-1::1738373837::0::1::::Wizard<>Piece<>:: ::res://scripts/title_screen/::1738707261 menu_button.gd::GDScript::-1::1738707261::0::1::::TitleButton<>Button<>:: diff --git a/.godot/editor/filesystem_update4 b/.godot/editor/filesystem_update4 index e1410dfacfb6cdfc0544588b6bc92e3cb617cf72..021a5938f55ec2ad448d2d1c7dfdaab4cd0afae3 100644 --- a/.godot/editor/filesystem_update4 +++ b/.godot/editor/filesystem_update4 @@ -1,6 +1,11 @@ -res://scenes/game.tscn res://assets/shaders/bg.gdshader res://assets/noise/noise.tres res://assets/noise/noise2.tres res://assets/noise/noise3.tres +res://Shop.tscn +res://Shop.gd +res://scripts/game.gd +res://scenes/game.tscn res://main.tscn +res://scenes/Shop.tscn +res://scripts/Shop.gd diff --git a/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg b/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg index 2309a88eddae135936e94a0ccf9bfa78af6d2d41..c5053912d751218b6f11be54ccf85a91bc508847 100644 --- a/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg +++ b/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg @@ -8,7 +8,7 @@ Anim={ "grid_snap_active": false, "grid_step": Vector2(8, 8), "grid_visibility": 1, -"ofs": Vector2(-1092.7, -448.319), +"ofs": Vector2(-390.56, -393.586), "primary_grid_step": Vector2i(8, 8), "show_group_gizmos": true, "show_guides": true, @@ -34,7 +34,7 @@ Anim={ "snap_rotation_step": 0.261799, "snap_scale": false, "snap_scale_step": 0.1, -"zoom": 0.471937 +"zoom": 0.629961 } 3D={ "fov": 70.01, @@ -175,4 +175,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@16886/@Panel@13/@VBoxContainer@14/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@25/DockVSplitCenter/@VSplitContainer@52/@VBoxContainer@53/@PanelContainer@98/MainScreen/@CanvasItemEditor@9272/@VSplitContainer@9094/@HSplitContainer@9096/@HSplitContainer@9098/@Control@9099/@SubViewportContainer@9100/@SubViewport@9101/Shop/Item1")]) diff --git a/.godot/editor/main.tscn-editstate-3070c538c03ee49b7677ff960a3f5195.cfg b/.godot/editor/main.tscn-editstate-3070c538c03ee49b7677ff960a3f5195.cfg index 18320f325388553a0617de231d3e360cf5fb277c..6278739e173a4509253cd1bf685b1e15526ae8ec 100644 --- a/.godot/editor/main.tscn-editstate-3070c538c03ee49b7677ff960a3f5195.cfg +++ b/.godot/editor/main.tscn-editstate-3070c538c03ee49b7677ff960a3f5195.cfg @@ -175,4 +175,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@16886/@Panel@13/@VBoxContainer@14/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@25/DockVSplitCenter/@VSplitContainer@52/@VBoxContainer@53/@PanelContainer@98/MainScreen/@CanvasItemEditor@9272/@VSplitContainer@9094/@HSplitContainer@9096/@HSplitContainer@9098/@Control@9099/@SubViewportContainer@9100/@SubViewport@9101/Shop/Item1")]) diff --git a/.godot/editor/project_metadata.cfg b/.godot/editor/project_metadata.cfg index b8740ce6a3d9276b6e25f74a65972b414ffff523..b57aa133e9e486b54ea77236d7839c2edd7bd25e 100644 --- a/.godot/editor/project_metadata.cfg +++ b/.godot/editor/project_metadata.cfg @@ -7,8 +7,13 @@ use_advanced_connections=false <<<<<<<HEADcreate_new_node=Rect2(2145, 197, 900, 700) project_settings=Rect2(2022, 76, 1590, 867) +create_new_node=Rect2(2430, 190, 900, 700) [recent_files] -scenes=["res://main.tscn", "res://scenes/game.tscn"] -scripts=["res://README.md"] +scenes=["res://Shop.tscn", "res://main.tscn", "res://scenes/game.tscn"] +scripts=["res://scripts/game.gd", "res://Shop.gd", "res://README.md"] + +[script_setup] + +last_selected_language="GDScript" diff --git a/.godot/editor/recent_dirs b/.godot/editor/recent_dirs index d8089ead6d56e347ec13f1d6600356a25aa1d9bb..c2cab24b0eb0d91051cfaa4b4a418c0d3f59092a 100644 --- a/.godot/editor/recent_dirs +++ b/.godot/editor/recent_dirs @@ -1,7 +1,7 @@ -res://scripts res://scenes +res:// +res://scripts res://assets/sprites res://assets/ui/title_screen res://scripts/title_screen res://assets/shaders -res:// diff --git a/.godot/editor/script_editor_cache.cfg b/.godot/editor/script_editor_cache.cfg index 0c3ce2baa5c2d95f093a2fdd960ddc91b1d4e64e..42173071a2269474bce4563a0dae0fb48579ff42 100644 --- a/.godot/editor/script_editor_cache.cfg +++ b/.godot/editor/script_editor_cache.cfg @@ -11,3 +11,31 @@ state={ "selection": false, "syntax_highlighter": "Plain Text" } + +[res://scripts/game.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 9, +"folded_lines": Array[int]([]), +"h_scroll_position": 0, +"row": 50, +"scroll_position": 39.0, +"selection": false, +"syntax_highlighter": "GDScript" +} + +[res://scripts/Shop.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 18, +"folded_lines": Array[int]([]), +"h_scroll_position": 0, +"row": 35, +"scroll_position": 0.0, +"selection": false, +"syntax_highlighter": "GDScript" +} diff --git a/.godot/uid_cache.bin b/.godot/uid_cache.bin index ee07e11edaec4721c201baa8b641e8186191b2ce..db3632908ccd371439677e93a6be9e5d85f34bdb 100644 Binary files a/.godot/uid_cache.bin and b/.godot/uid_cache.bin differ diff --git a/scenes/Shop.tscn b/scenes/Shop.tscn new file mode 100644 index 0000000000000000000000000000000000000000..c57ba06b909091e61c7fb4cff7507d4b56402e5b --- /dev/null +++ b/scenes/Shop.tscn @@ -0,0 +1,60 @@ +[gd_scene load_steps=2 format=3 uid="uid://ct878s7wjsq77"] + +[ext_resource type="Script" path="res://scripts/Shop.gd" id="1_8nmap"] + +[node name="Shop" type="Node2D"] +script = ExtResource("1_8nmap") + +[node name="Background" type="TextureRect" parent="."] +offset_right = 131.0 +offset_bottom = 101.0 + +[node name="Title" type="Label" parent="."] +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = -20.0 +offset_top = -24.0 +offset_right = 20.0 +offset_bottom = -1.0 +grow_horizontal = 2 +text = "Shop" + +[node name="Item1" type="Button" parent="."] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -59.0 +offset_top = 30.0 +offset_right = -2.0 +offset_bottom = 61.0 +grow_horizontal = 2 +grow_vertical = 2 +text = "Item 1" + +[node name="Item2" type="Button" parent="."] +offset_left = 2.0 +offset_top = 30.0 +offset_right = 59.0 +offset_bottom = 61.0 +text = "Item 2" + +[node name="GoldDisplay" type="Label" parent="."] +offset_left = -21.0 +offset_top = 2.0 +offset_right = 21.0 +offset_bottom = 26.0 + +[node name="BackButton" type="Button" parent="."] +offset_left = -23.0 +offset_top = 68.0 +offset_right = 22.0 +offset_bottom = 99.0 +text = "Back +" + +[connection signal="item_purchased" from="." to="." method="_on_item_purchased"] +[connection signal="pressed" from="Item1" to="." method="_on_item_1_pressed"] +[connection signal="pressed" from="Item2" to="." method="_on_item_2_pressed"] diff --git a/scenes/game.tscn b/scenes/game.tscn index 5f027e294f8c6e5918dfdcfe49bfded4bf491463..72a98bdf1e807d24bebf3db06bd10b63e5dae71c 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -63,3 +63,26 @@ position = Vector2(100, 400) [node name="OpponentPieces" type="Node2D" parent="."] position = Vector2(100, 100) + +[node name="ShopButton" type="Button" parent="."] +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -25.0 +offset_bottom = 20.0 +grow_horizontal = 0 +size_flags_horizontal = 8 +size_flags_vertical = 0 +text = "Shop Button" + +[node name="GoldDisplay" type="Label" parent="."] +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -125.0 +offset_top = 36.0 +offset_right = -2.0 +offset_bottom = 103.0 +grow_horizontal = 0 + +[connection signal="pressed" from="ShopButton" to="." method="_on_shop_button_pressed"] diff --git a/scripts/Shop.gd b/scripts/Shop.gd new file mode 100644 index 0000000000000000000000000000000000000000..18c06d38f7028a942cdee94301c6292d7f00137a --- /dev/null +++ b/scripts/Shop.gd @@ -0,0 +1,57 @@ +# Shop.gd +extends Node2D + +signal item_purchased(item_name: String) # Define the signal +signal gold_spent(amount: int) + +@onready var gold_display: Label = $GoldDisplay +var player_gold: int = 0 # Declare player_gold variable + +func _ready(): + self.visible = false # Start hidden + print("Shop scene loaded!") # Check if this prints + update_gold_display(player_gold) # Initialize gold display + # connect the signals + $Item1.connect("pressed", Callable(self, "_on_item1_pressed")) + $Item2.connect("pressed", Callable(self, "_on_item2_pressed")) + +func set_visibility(visible: bool): + self.visible = visible + +func update_gold_display(gold: int): + player_gold = gold # Store gold locally for shop logic + gold_display.text = "Gold: %d" % player_gold + +func _on_item1_pressed(): + print("Item1 pressed!") + if player_gold >= 1: # Example cost + player_gold -= 1 + # Apply item effect (e.g., upgrade a piece) + update_gold_display(player_gold) + emit_signal("gold_spent", 1) # Emit the signal + emit_signal("item_purchased", "item1") # Notify main game scene + print("SHOP: Item 1 purchased") + +func _on_item2_pressed(): + print("Item2 pressed!") + if player_gold >= 2: # Example cost for Item2 + player_gold -= 2 + update_gold_display(player_gold) + emit_signal("gold_spent", 2) # Emit the signal + emit_signal("item_purchased", "item2") # Emit signal for Item2 + print("SHOP: Item 2 purchased") + +func _on_back_button_pressed(): + get_tree().change_scene_to_file("res://Game.tscn") # Return to game + + +func _on_item_1_pressed() -> void: + pass # Replace with function body. + + +func _on_item_2_pressed() -> void: + pass # Replace with function body. + + +func _on_item_purchased(item_name: String) -> void: + pass # Replace with function body. diff --git a/scripts/game.gd b/scripts/game.gd index 3011c2b34c73876514a47db3368855c4d142305c..1e329427be7379bdd122e00b5fdc1eeb36424b84 100644 --- a/scripts/game.gd +++ b/scripts/game.gd @@ -1,6 +1,10 @@ extends Node class_name game +var player_gold: int = 10 +var shop_scene = preload("res://scenes/Shop.tscn") +var shop: Node2D + @export var tile_size = 64 @export var dark = Color(0,0,0,1) @export var light =Color(1,1,1,1) @@ -20,6 +24,7 @@ class_name game @onready var player_piece_count = 0 @onready var opponent_pieces = $OpponentPieces @onready var opponent_piece_count = 0 +@onready var gold_display: Label = $GoldDisplay var selected_piece var selected_piece_value @@ -39,6 +44,16 @@ var player_turn : bool = true func _ready() -> void: + shop = shop_scene.instantiate() + add_child(shop) + shop.position = Vector2(200, 200) + shop.visible = false # Start hidden + if shop.has_signal("gold_spent"): # Check if the signal exists + shop.gold_spent.connect(_on_gold_spent) + else: + print("Error: 'gold_spent' signal not found in shop!") + update_gold_display() # Initialize gold display + DisplayServer.window_set_min_size(Vector2(1152, 648)) # Set minimum window size #creates 2D array for board, with empty (null) spaces @@ -483,3 +498,40 @@ func shoot_projectile(x: int, y: int): explosion_effect.restart() # player_turn = !player_turn + + +# Shop Stuff +func _on_shop_button_pressed(): + print("Attempting to open shop...") + shop.visible = !shop.visible + shop.update_gold_display(player_gold) # Pass current gold to shop + print("Shop added to scene tree!") # Check if this prints + +# Signal handler method +func _on_item_purchased(item_name: String): + print("Signal received: ", item_name) + match item_name: + "item1": + player_gold -= 1 + print("Purchased Item 1! Remaining gold: ", player_gold) + # Add logic to apply the item effect + "item2": + player_gold -= 2 + print("Purchased Item 2! Remaining gold: ", player_gold) + + +func _on_shop_item_purchased(item_name: String) -> void: + print("Signal received: ", item_name) + match item_name: + "item1": + player_gold -= 10 + print("Purchased Item 1! Remaining gold: ", player_gold) + + +func _on_gold_spent(amount: int): + player_gold -= amount + update_gold_display() # Update the gold display + print("Gold spent: %d. Remaining gold: %d" % [amount, player_gold]) + +func update_gold_display(): + gold_display.text = "Gold: %d" % player_gold