From 44ed5b2953a2c903441cff11e7709982fec160f8 Mon Sep 17 00:00:00 2001 From: Jona Lam <89871543+JonaLam@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:18:49 +0100 Subject: [PATCH 01/12] Shop Scene --- #Scenes/Events/shop/0.t1104.tmp | 37 ++++++ #Scenes/Events/shop/0.tscn | 184 +++++++++++++++++++++++++----- #Scenes/SceneScripts/ShopScene.gd | 9 ++ Art/Background/CatTree.png | Bin 0 -> 1790 bytes Art/Background/CatTree.png.import | 34 ++++++ Managers/ShopManager.gd | 27 +++++ 6 files changed, 264 insertions(+), 27 deletions(-) create mode 100644 #Scenes/Events/shop/0.t1104.tmp create mode 100644 Art/Background/CatTree.png create mode 100644 Art/Background/CatTree.png.import create mode 100644 Managers/ShopManager.gd diff --git a/#Scenes/Events/shop/0.t1104.tmp b/#Scenes/Events/shop/0.t1104.tmp new file mode 100644 index 00000000..e1116b87 --- /dev/null +++ b/#Scenes/Events/shop/0.t1104.tmp @@ -0,0 +1,37 @@ +[gd_scene load_steps=8 format=3 uid="uid://b8hbst1klk5ng"] + +[ext_resource type="PackedScene" uid="uid://bam77cwf4emyr" path="res://#Scenes/TopBarOverlay.tscn" id="1_7gwvp"] +[ext_resource type="Script" path="res://#Scenes/SceneScripts/ShopScene.gd" id="1_u1m6k"] +[ext_resource type="Resource" uid="uid://uv2rili0xf3x" path="res://Cards/Resource/Card_Damage_EVERYTHING.tres" id="2_u60ec"] +[ext_resource type="Texture2D" uid="uid://bo0j1ve4n2ni7" path="res://Art/Background/Shop_Background.png" id="3_6osfu"] +[ext_resource type="Resource" uid="uid://d4lugn62mmlep" path="res://Cards/Resource/Card_DrawCards.tres" id="3_trwis"] +[ext_resource type="PackedScene" uid="uid://cdt4k2reymt2i" path="res://Shop/shop_item.tscn" id="4_bbct0"] +[ext_resource type="Resource" uid="uid://0x385c3nuq8f" path="res://Cards/Resource/Card_DamageAllEnemies.tres" id="4_e4vp7"] + +[node name="Control" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_u1m6k") +cardPool = Array[Object]([ExtResource("2_u60ec"), ExtResource("3_trwis"), ExtResource("4_e4vp7")]) + +[node name="TopBarOverlay" parent="." instance=ExtResource("1_7gwvp")] +layout_mode = 1 + +[node name="TextureRect" type="TextureRect" parent="."] +layout_mode = 0 +offset_left = 20.0 +offset_top = 16.0 +offset_right = 1068.0 +offset_bottom = 1064.0 +texture = ExtResource("3_6osfu") +expand_mode = 1 + +[node name="ShopItem" parent="." instance=ExtResource("4_bbct0")] +offset_left = 216.0 +offset_top = 252.0 +offset_right = 216.0 +offset_bottom = 252.0 diff --git a/#Scenes/Events/shop/0.tscn b/#Scenes/Events/shop/0.tscn index 56bd4e34..c456706a 100644 --- a/#Scenes/Events/shop/0.tscn +++ b/#Scenes/Events/shop/0.tscn @@ -1,44 +1,174 @@ -[gd_scene load_steps=4 format=3 uid="uid://b8hbst1klk5ng"] +[gd_scene load_steps=10 format=3 uid="uid://b8hbst1klk5ng"] [ext_resource type="PackedScene" uid="uid://bam77cwf4emyr" path="res://#Scenes/TopBarOverlay.tscn" id="1_7gwvp"] [ext_resource type="Script" path="res://#Scenes/SceneScripts/ShopScene.gd" id="1_u1m6k"] -[ext_resource type="Script" path="res://#Scenes/Events/skipEventButton.gd" id="2_owx5q"] +[ext_resource type="PackedScene" uid="uid://cdt4k2reymt2i" path="res://Shop/shop_item_card.tscn" id="4_bbct0"] +[ext_resource type="Texture2D" uid="uid://c6fmkrnbs4mf6" path="res://Art/Background/CatTree.png" id="6_ppjdl"] +[ext_resource type="PackedScene" uid="uid://bmklwr3ycyicn" path="res://Shop/shop_item_relic.tscn" id="8_i0gsy"] +[ext_resource type="PackedScene" uid="uid://c4bsmddaua2ye" path="res://Shop/shop_item_consumable.tscn" id="10_jre48"] +[ext_resource type="PackedScene" uid="uid://tfeo4epmhse0" path="res://Shop/shop_item_torch.tscn" id="11_3t8vb"] +[ext_resource type="Script" path="res://#Scenes/Events/shop/CardRemoval.gd" id="12_1uxnd"] +[ext_resource type="Texture2D" uid="uid://dd06ocktximw7" path="res://Art/Background/Trash.png" id="12_yofyg"] [node name="Control" type="Control"] layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 +offset_left = 41.0 +offset_top = -11.0 +offset_right = 41.0 +offset_bottom = -11.0 grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_u1m6k") -[node name="TextEdit" type="TextEdit" parent="."] -layout_mode = 0 -offset_right = 1276.0 -offset_bottom = 715.0 -theme_override_font_sizes/font_size = 100 -placeholder_text = "This is a placeholder -shop event" - [node name="TopBarOverlay" parent="." instance=ExtResource("1_7gwvp")] layout_mode = 1 -[node name="SkipEventButton" type="Button" parent="."] +[node name="ShopItems" type="Control" parent="."] +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="ShopItemTorch" parent="ShopItems" instance=ExtResource("11_3t8vb")] +offset_left = 835.0 +offset_top = 116.0 +offset_right = 835.0 +offset_bottom = 116.0 +amount = 5 + +[node name="Card" type="Control" parent="ShopItems"] +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="ShopItemCard" parent="ShopItems/Card" instance=ExtResource("4_bbct0")] +offset_left = 1111.0 +offset_top = 424.0 +offset_right = 1111.0 +offset_bottom = 424.0 + +[node name="ShopItem" parent="ShopItems/Card" instance=ExtResource("4_bbct0")] +offset_left = 648.0 +offset_top = 404.0 +offset_right = 648.0 +offset_bottom = 404.0 + +[node name="ShopItem2" parent="ShopItems/Card" instance=ExtResource("4_bbct0")] +offset_left = 891.0 +offset_top = 414.0 +offset_right = 891.0 +offset_bottom = 414.0 + +[node name="Item" type="Control" parent="ShopItems"] +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="ShopItemItem" parent="ShopItems/Item" instance=ExtResource("8_i0gsy")] +offset_left = 183.0 +offset_top = 904.0 +offset_right = 183.0 +offset_bottom = 904.0 + +[node name="ShopItemItem2" parent="ShopItems/Item" instance=ExtResource("8_i0gsy")] +offset_left = 363.0 +offset_top = 901.0 +offset_right = 363.0 +offset_bottom = 901.0 + +[node name="ShopItem" parent="ShopItems/Item" instance=ExtResource("8_i0gsy")] +offset_left = 552.0 +offset_top = 906.0 +offset_right = 552.0 +offset_bottom = 906.0 + +[node name="Consumables" type="Control" parent="ShopItems"] +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="ShopItemConsumable" parent="ShopItems/Consumables" instance=ExtResource("10_jre48")] +offset_left = 257.0 +offset_top = 113.0 +offset_right = 257.0 +offset_bottom = 113.0 + +[node name="ShopItemConsumable2" parent="ShopItems/Consumables" instance=ExtResource("10_jre48")] +offset_left = 472.0 +offset_top = 117.0 +offset_right = 472.0 +offset_bottom = 117.0 + +[node name="ShopItemConsumable3" parent="ShopItems/Consumables" instance=ExtResource("10_jre48")] +offset_left = 650.0 +offset_top = 107.0 +offset_right = 650.0 +offset_bottom = 107.0 + +[node name="CardRemoval" type="TextureButton" parent="ShopItems"] layout_mode = 1 -anchors_preset = 3 -anchor_left = 1.0 -anchor_top = 1.0 -anchor_right = 1.0 -anchor_bottom = 1.0 -offset_left = -280.0 -offset_top = -220.0 -offset_right = -80.0 -offset_bottom = -140.0 -grow_horizontal = 0 -grow_vertical = 0 -theme_override_font_sizes/font_size = 26 -text = "Skip this event" -script = ExtResource("2_owx5q") - -[connection signal="pressed" from="SkipEventButton" to="SkipEventButton" method="_on_pressed"] +anchors_preset = -1 +anchor_left = 1.00078 +anchor_right = 1.00078 +offset_left = 731.966 +offset_top = 769.0 +offset_right = 791.966 +offset_bottom = 829.0 +scale = Vector2(2.92, 2.92) +texture_normal = ExtResource("12_yofyg") +texture_pressed = ExtResource("12_yofyg") +texture_hover = ExtResource("12_yofyg") +texture_disabled = ExtResource("12_yofyg") +texture_focused = ExtResource("12_yofyg") +stretch_mode = 0 +script = ExtResource("12_1uxnd") + +[node name="CardRemoval" type="Control" parent="ShopItems/CardRemoval"] +anchors_preset = 0 +offset_left = -27.0 +offset_top = -11.0 +offset_right = -27.0 +offset_bottom = -11.0 + +[node name="ColorRect" type="ColorRect" parent="ShopItems/CardRemoval/CardRemoval"] +layout_mode = 0 +offset_left = 23.5753 +offset_top = 76.7534 +offset_right = 86.5753 +offset_bottom = 100.753 + +[node name="Label" type="Label" parent="ShopItems/CardRemoval/CardRemoval/ColorRect"] +layout_mode = 0 +offset_left = -0.109672 +offset_top = 0.602746 +offset_right = 61.8903 +offset_bottom = 23.6027 +scale = Vector2(0.998719, 1.01696) +theme_override_colors/font_color = Color(0, 0, 0, 1) +text = "100" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="BackGround" type="TextureRect" parent="."] +z_index = -1 +layout_mode = 0 +offset_left = -53.0 +offset_top = 10.0 +offset_right = 1960.0 +offset_bottom = 1111.0 +mouse_filter = 2 +texture = ExtResource("6_ppjdl") +expand_mode = 1 + +[node name="Button" type="Button" parent="."] +layout_mode = 0 +offset_left = 1352.0 +offset_top = 226.0 +offset_right = 1815.0 +offset_bottom = 392.0 +theme_override_font_sizes/font_size = 116 +text = "Proceed" + +[connection signal="pressed" from="Button" to="." method="_on_button_pressed"] diff --git a/#Scenes/SceneScripts/ShopScene.gd b/#Scenes/SceneScripts/ShopScene.gd index 219c0d12..73c33116 100644 --- a/#Scenes/SceneScripts/ShopScene.gd +++ b/#Scenes/SceneScripts/ShopScene.gd @@ -1,4 +1,13 @@ extends Control +class_name ShopScene func _ready() -> void: SaveManager.execute_save() + +func _stock_shop() -> void: + pass + + +func _on_button_pressed() -> void: + PlayerManager.player_room.room_event.on_event_ended() + pass # Replace with function body. diff --git a/Art/Background/CatTree.png b/Art/Background/CatTree.png new file mode 100644 index 0000000000000000000000000000000000000000..772c65507e4c10687a705b8c6f74c40ffc3af74f GIT binary patch literal 1790 zcmeAS@N?(olHy`uVBq!ia0y~yV4MrY3><7gkqq_K_CSiUILO_JVcj{ImkbPSJ3L(+ zLn`LHz5BLswFN_4;0@2nm&&XEch=nD!7#}bO_2aB)PCRNYI;GnQ7agtCzoiZTo=(_w4PW`5D_%moq!` zykHPewqiKa!N*{@h?d+lFP-@V>p>DQPU z`m*OepB=Bgl*Ro};Ek6Iv+r>8-BGeSkmcQ^?DfaBq#^W3OM1mJW*s$)ny+8KC%!bc zxyUFcD6{P4&-=_58Rb?<&WXN%`*!}{n~%RAFqT~~%f0)`-u1U5zoxGLDIlwmH!nT^ zz}zV>7y_M&bgJVOI`{-Ot6C^s_3JIR7x#bt2pmBS`}fq>-240M8taQ)M{G7XL@xWZ z?acK_m76XzifJy*iTm?5Y=@9+!qlw~1?N0oX_>x=d5w}%@@m`tiW{zT z^6(V|Yd(FqcIN9tmoLAS-WP3UzLJ|A=&q_Q5}fBgs+O->#C+$9k;Z46-MQbF$mw&~ zTxPV`SaQRa{l~F)O|x9sUxf8Du;!VRh$uiD#94$K6XB&aV3?xFFfP z?YOaQg1G(R$1_iFT=H+qk(ii88xB5wYg)GEd;j?x8*lW#knvYy&s)zJx?|o`{YA_N zOnhhFT?x*04yJh4<0Z#o&OqZb_{tud0GGJYj--)^J+lrbdDe0D5hY~ z*bbsgr(APh;0%e6t2f?$xa|F!ks(=o>6~|m?WZ64mh=3HR|$iZMfQw4am=f%Z|80k zOx`Gdkx?nD{drEJwHCP4YLM7H@$m{%V65^uU-_kO<>0fH{mtTIX-DRJmozNw*%9zQ z_2tf$m3*%35`7=Oc$YBzh<}^V&1bMAu*|ypzs%b6K&Q5s+WM8FFju)c9C(` zja?ke{>%Orl3g(KOP{LXyjjO36z9aLFwBbjw4na{(Qm)@eyiK5Aljn)_`POWnUzDa zuGrCeVvltDtm>>~7jWwy-duY9a@E6lqkq?u|D5z=x7Zux^*#T{-OZ_g)&evBAN9XA znfbQ;Z-L>l&*IRb+7w_MB1IECfX^(w_`4BUs)@C?F5g>UvrUdkX4+iz7@~3E3M$2o nrw4hxc4R2vD?=^LKkH|&oqYekqmmb}LSyiB^>bP0l+XkKX;0SH literal 0 HcmV?d00001 diff --git a/Art/Background/CatTree.png.import b/Art/Background/CatTree.png.import new file mode 100644 index 00000000..3b33f982 --- /dev/null +++ b/Art/Background/CatTree.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c6fmkrnbs4mf6" +path="res://.godot/imported/CatTree.png-d58f5c3bb4506352afe76dd76a5fa527.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/Background/CatTree.png" +dest_files=["res://.godot/imported/CatTree.png-d58f5c3bb4506352afe76dd76a5fa527.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Managers/ShopManager.gd b/Managers/ShopManager.gd new file mode 100644 index 00000000..52e906b9 --- /dev/null +++ b/Managers/ShopManager.gd @@ -0,0 +1,27 @@ +extends Node +## Manager class for the shop + +## price for card removal at the shop events +var card_removal_price : int = 50 +var card_remocal_price_increase : int = 25 + +## the item pools for the various things provided in the shop[br] +## the items are loaded when taken so all that is needed here are strings to the items +var shop_card_pool : Array = ["res://Cards/Resource/Card_Damage.tres", "res://Cards/Resource/Card_DamageAllEnemies.tres"] +var shop_relic_pool : Array = ["res://Items/test_relic.tres", "res://Items/test_relic_2.tres"] +var shop_consumable_pool : Array = ["res://Items/test_consumable.tres","res://Items/test_consumable_2.tres"] + +func increase_removal_price() -> void: + card_removal_price += card_remocal_price_increase + + +## Removes given card, takes money, and increases shop prices. Should only be used by the shop removal[br] +## or potentionaly a specific event +func remove_card_from_player_deck_with_price(card : CardBase) -> void: + CardManager.current_deck.erase(card) + InventoryManager.gold_component.lose_gold(card_removal_price) + increase_removal_price() + +## Should be used any time card should be removed from deck +func remove_card_from_player_deck_without_price(card : CardBase) -> void: + CardManager.current_deck.erase(card) From 35a64ba3002657bec7250ba81c926773e72d5645 Mon Sep 17 00:00:00 2001 From: Jona Lam <89871543+JonaLam@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:19:53 +0100 Subject: [PATCH 02/12] Shop items --- #Scenes/Events/shop/CardRemoval.gd | 22 ++++++++++++ Art/Background/Trash.png | Bin 0 -> 184 bytes Art/Background/Trash.png.import | 34 ++++++++++++++++++ Art/Items/Tourch.png | Bin 0 -> 360 bytes Art/Items/Tourch.png.import | 34 ++++++++++++++++++ Cards/CardContainer.tscn | 10 +----- Cards/CardWorld.gd | 7 ++++ Items/test_consumable_2.tres | 10 ++++++ Items/test_relic.tres | 2 +- Shop/ShopItem.gd | 23 ++++++++++++ Shop/ShopItemCard.gd | 16 +++++++++ Shop/shop_item_card.tscn | 41 +++++++++++++++++++++ Shop/shop_item_consumable.gd | 19 ++++++++++ Shop/shop_item_consumable.tscn | 50 ++++++++++++++++++++++++++ Shop/shop_item_relic.gd | 16 +++++++++ Shop/shop_item_relic.tscn | 48 +++++++++++++++++++++++++ Shop/shop_item_torch.gd | 33 +++++++++++++++++ Shop/shop_item_torch.tscn | 56 +++++++++++++++++++++++++++++ Shop/tourchDisplay.tscn | 8 +++++ UI/CardScrollUI.gd | 15 +++++++- project.godot | 1 + 21 files changed, 434 insertions(+), 11 deletions(-) create mode 100644 #Scenes/Events/shop/CardRemoval.gd create mode 100644 Art/Background/Trash.png create mode 100644 Art/Background/Trash.png.import create mode 100644 Art/Items/Tourch.png create mode 100644 Art/Items/Tourch.png.import create mode 100644 Items/test_consumable_2.tres create mode 100644 Shop/ShopItem.gd create mode 100644 Shop/ShopItemCard.gd create mode 100644 Shop/shop_item_card.tscn create mode 100644 Shop/shop_item_consumable.gd create mode 100644 Shop/shop_item_consumable.tscn create mode 100644 Shop/shop_item_relic.gd create mode 100644 Shop/shop_item_relic.tscn create mode 100644 Shop/shop_item_torch.gd create mode 100644 Shop/shop_item_torch.tscn create mode 100644 Shop/tourchDisplay.tscn diff --git a/#Scenes/Events/shop/CardRemoval.gd b/#Scenes/Events/shop/CardRemoval.gd new file mode 100644 index 00000000..f0305c08 --- /dev/null +++ b/#Scenes/Events/shop/CardRemoval.gd @@ -0,0 +1,22 @@ +extends CardPileUISetter + +@onready var priceText : Label = $CardRemoval/ColorRect/Label + +func _ready() -> void: + priceText.text = str(ShopManager.card_removal_price) + super() + +func _pressed() -> void: + if(!InventoryManager.gold_component.can_afford(ShopManager.card_removal_price)): + return + + + var uiPile: Control = cardUI.instantiate() + + uiPile.populate(get_name()) + parent.add_child(uiPile) + queue_free() + +func _on_button_pressed() -> void: + + pass diff --git a/Art/Background/Trash.png b/Art/Background/Trash.png new file mode 100644 index 0000000000000000000000000000000000000000..207fa5634f8933954dfca838cde929633545371f GIT binary patch literal 184 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|iacE$Lo9le z6C~a|uorpE(o)o;t%Zf0*cK5*lO zNl)*ZcFvnyt|a(RntQ+{f>V-B!BSLPem&!lJ&nG6(T9HYpAK8Ws8RJ{nad2t3^Uhr>mdKI;Vst0H%pTK>z>% literal 0 HcmV?d00001 diff --git a/Art/Background/Trash.png.import b/Art/Background/Trash.png.import new file mode 100644 index 00000000..9bd88e0d --- /dev/null +++ b/Art/Background/Trash.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dd06ocktximw7" +path="res://.godot/imported/Trash.png-b76c4a8e7231dce5a7a6c2092684f711.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/Background/Trash.png" +dest_files=["res://.godot/imported/Trash.png-b76c4a8e7231dce5a7a6c2092684f711.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Art/Items/Tourch.png b/Art/Items/Tourch.png new file mode 100644 index 0000000000000000000000000000000000000000..28e99aef300412103e50f866ffe7c12d7b0acbb0 GIT binary patch literal 360 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D%zl{{S>Ln`LH zoo&l?C_tdaTuJQSLFOgmTfWN49e5mZt6J)y9s3Ev7Lm-P%qtK4jqf+lU0-8!BXP#| z-7G?hJ%-05l6}0i0_Q$F|6428FkDnB?|u68*N@)j?0(IfC3j}YRjwm!7nm|qY!hDX z&A)c*yPfMVmKzLF481vmQokU)Z8zCx=*OVjpthHBlWRs-)mD|$?k&O#Oc%7Q``;z(z`bB2;}!-fX&}Qhzad9h z=KTLjWsK?$p)aQIy)W;|m;=zopr0G2t3jQ{`u literal 0 HcmV?d00001 diff --git a/Art/Items/Tourch.png.import b/Art/Items/Tourch.png.import new file mode 100644 index 00000000..1ff1a866 --- /dev/null +++ b/Art/Items/Tourch.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://q8og304npj17" +path="res://.godot/imported/Tourch.png-94c708f8cbc15c61a8fc8ebd4d244dbc.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Art/Items/Tourch.png" +dest_files=["res://.godot/imported/Tourch.png-94c708f8cbc15c61a8fc8ebd4d244dbc.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Cards/CardContainer.tscn b/Cards/CardContainer.tscn index a3a71969..85614d41 100644 --- a/Cards/CardContainer.tscn +++ b/Cards/CardContainer.tscn @@ -1,14 +1,7 @@ -[gd_scene load_steps=9 format=3 uid="uid://dpjfy4pv0vxst"] +[gd_scene load_steps=3 format=3 uid="uid://dpjfy4pv0vxst"] [ext_resource type="Script" path="res://Cards/CardContainer.gd" id="1_8wctf"] [ext_resource type="PackedScene" uid="uid://caxbd2ppk3ans" path="res://Cards/Card.tscn" id="2_ytmtr"] -[ext_resource type="Resource" uid="uid://dxgoopi1roxu4" path="res://Cards/Resource/Card_Damage.tres" id="3_bi3df"] -[ext_resource type="Resource" uid="uid://0x385c3nuq8f" path="res://Cards/Resource/Card_DamageAllEnemies.tres" id="4_14cb3"] -[ext_resource type="Resource" uid="uid://boodcfdepyk5i" path="res://Cards/Resource/Card_DamageHealth.tres" id="5_dugjd"] -[ext_resource type="Resource" uid="uid://d4lugn62mmlep" path="res://Cards/Resource/Card_DrawCards.tres" id="6_56fxe"] -[ext_resource type="Resource" uid="uid://d12g33rc6c3u5" path="res://Cards/Resource/Card_Heal.tres" id="7_6wjqi"] -[ext_resource type="Resource" uid="uid://ctx8jsvac84so" path="res://Cards/Resource/Card_Poison.tres" id="8_gbk7f"] -[ext_resource type="Resource" uid="uid://uv2rili0xf3x" path="res://Cards/Resource/Card_Damage_EVERYTHING.tres" id="9_df5d4"] [node name="CardContainer" type="Control"] layout_mode = 3 @@ -17,4 +10,3 @@ script = ExtResource("1_8wctf") card_scene = ExtResource("2_ytmtr") total_hand_width = 500.0 card_queued_offset = 200.0 -default_deck = Array[Resource("res://Cards/CardBase.gd")]([ExtResource("3_bi3df"), ExtResource("4_14cb3"), ExtResource("5_dugjd"), ExtResource("6_56fxe"), ExtResource("7_6wjqi"), ExtResource("8_gbk7f"), ExtResource("9_df5d4")]) diff --git a/Cards/CardWorld.gd b/Cards/CardWorld.gd index 5d1219b7..f3b6f969 100644 --- a/Cards/CardWorld.gd +++ b/Cards/CardWorld.gd @@ -24,6 +24,13 @@ func init_card(in_card_data: CardBase) -> void: card_cast_type = GlobalEnums.CardCastType.TARGET break +## takes money and increases price of shop removal, should only be used when this is wanted +func remove_this_from_player_deck_with_price() -> void: + ShopManager.remove_card_from_player_deck_with_price(card_data) + +## this should be used most of the time we want to take a card from the player +func remove_this_from_player_deck_without_price() -> void: + ShopManager.remove_card_from_player_deck_without_price(card_data) func _on_phase_changed(new_phase: GlobalEnums.CombatPhase, _old_phase: GlobalEnums.CombatPhase) -> void: # enable clicks on card only if player is in attack phase diff --git a/Items/test_consumable_2.tres b/Items/test_consumable_2.tres new file mode 100644 index 00000000..d87aa163 --- /dev/null +++ b/Items/test_consumable_2.tres @@ -0,0 +1,10 @@ +[gd_resource type="Resource" script_class="Consumable" load_steps=2 format=3 uid="uid://qclftsxybsw"] + +[ext_resource type="Script" path="res://Items/Consumable.gd" id="1_5ygqd"] + +[resource] +resource_name = "Amoogus" +script = ExtResource("1_5ygqd") +name = "Golden apple" +description = "But she eated it" +image_path = "res://Art/Card_art/default_art.png" diff --git a/Items/test_relic.tres b/Items/test_relic.tres index c28199b7..7e7e25cc 100644 --- a/Items/test_relic.tres +++ b/Items/test_relic.tres @@ -6,4 +6,4 @@ script = ExtResource("1_pjxtd") name = "Defualt Icon" description = "test_desc" -sprite_path = "res://icon.svg" +sprite_path = "res://addons/gut/icon.png" diff --git a/Shop/ShopItem.gd b/Shop/ShopItem.gd new file mode 100644 index 00000000..e022c5c0 --- /dev/null +++ b/Shop/ShopItem.gd @@ -0,0 +1,23 @@ +extends Control +class_name ShopItem + +## base class for all items sold in the shop +## The classes deriving from this are named shopitem[item which is sold] + +@export var cost : int +@export var priceLabel : Label + +func _ready() -> void: + priceLabel.text = str(cost) + +func on_shop_item_clicked() ->void: + if(InventoryManager.gold_component.can_afford(cost)): + queue_free() + InventoryManager.gold_component.lose_gold(cost) + _give_player_item() + else: + print("can't afford") + +## this is an abstract class where each of the derived classes change to give the player their item +func _give_player_item() -> void: + pass diff --git a/Shop/ShopItemCard.gd b/Shop/ShopItemCard.gd new file mode 100644 index 00000000..eb705b6a --- /dev/null +++ b/Shop/ShopItemCard.gd @@ -0,0 +1,16 @@ +extends ShopItem + +@export var cardWorld : CardWorld +var card : CardBase + +func _ready() -> void: + var rand : RandomNumberGenerator = RandomNumberGenerator.new() + card = load(ShopManager.shop_card_pool[rand.randi_range(0, ShopManager.shop_card_pool.size() - 1)]) + + cardWorld.init_card(card) + cardWorld.get_click_handler().on_click.connect(on_shop_item_clicked) + super() + + +func _give_player_item() -> void: + CardManager.current_deck.append(card) diff --git a/Shop/shop_item_card.tscn b/Shop/shop_item_card.tscn new file mode 100644 index 00000000..4c9f9540 --- /dev/null +++ b/Shop/shop_item_card.tscn @@ -0,0 +1,41 @@ +[gd_scene load_steps=3 format=3 uid="uid://cdt4k2reymt2i"] + +[ext_resource type="Script" path="res://Shop/ShopItemCard.gd" id="1_4ryor"] +[ext_resource type="PackedScene" uid="uid://caxbd2ppk3ans" path="res://Cards/Card.tscn" id="2_2bk7m"] + +[node name="ShopItemCard" type="Control" node_paths=PackedStringArray("cardWorld", "priceLabel")] +layout_mode = 3 +anchors_preset = 0 +offset_left = -1.0 +offset_right = -1.0 +script = ExtResource("1_4ryor") +cardWorld = NodePath("Card") +cost = 25 +priceLabel = NodePath("PriceLabel/Label") + +[node name="Card" parent="." instance=ExtResource("2_2bk7m")] +offset_left = -1.0 +offset_top = -14.0 +offset_right = -1.0 +offset_bottom = -14.0 + +[node name="PriceLabel" type="ColorRect" parent="."] +layout_mode = 0 +offset_left = -80.0 +offset_top = 129.0 +offset_right = 74.0 +offset_bottom = 169.0 + +[node name="Label" type="Label" parent="PriceLabel"] +layout_mode = 0 +offset_left = 4.0 +offset_top = 2.0 +offset_right = 152.0 +offset_bottom = 40.0 +theme_override_colors/font_color = Color(0, 0, 0, 1) +text = "dfdsfds +" +horizontal_alignment = 1 +vertical_alignment = 1 + +[editable path="Card"] diff --git a/Shop/shop_item_consumable.gd b/Shop/shop_item_consumable.gd new file mode 100644 index 00000000..7c95ece1 --- /dev/null +++ b/Shop/shop_item_consumable.gd @@ -0,0 +1,19 @@ +extends ShopItem + +var consumable : Consumable +@export var consumableImage : TextureButton +@export var clickHandler : ClickHandler + + +func _ready() -> void: + var rand : RandomNumberGenerator = RandomNumberGenerator.new() + consumable = load(ShopManager.shop_consumable_pool[rand.randi_range(0, ShopManager.shop_consumable_pool.size() - 1)]) + + + consumableImage.texture_normal = load(consumable.image_path) + clickHandler.on_click.connect(on_shop_item_clicked) + super() + + +func _give_player_item() -> void: + InventoryManager.consumable_component.add_consumable(consumable) diff --git a/Shop/shop_item_consumable.tscn b/Shop/shop_item_consumable.tscn new file mode 100644 index 00000000..bb1609cb --- /dev/null +++ b/Shop/shop_item_consumable.tscn @@ -0,0 +1,50 @@ +[gd_scene load_steps=3 format=3 uid="uid://c4bsmddaua2ye"] + +[ext_resource type="Script" path="res://Shop/shop_item_consumable.gd" id="1_m5rmx"] +[ext_resource type="Script" path="res://Input/ClickHandler.gd" id="3_h2ml3"] + +[node name="ShopItemConsumable" type="Control" node_paths=PackedStringArray("consumableImage", "clickHandler", "priceLabel")] +layout_mode = 3 +anchors_preset = 0 +script = ExtResource("1_m5rmx") +consumableImage = NodePath("TextureRect") +clickHandler = NodePath("ClickHandler") +cost = 5 +priceLabel = NodePath("PriceLabel/Label") + +[node name="PriceLabel" type="ColorRect" parent="."] +layout_mode = 0 +offset_left = -80.0 +offset_top = 55.0 +offset_right = 74.0 +offset_bottom = 95.0 + +[node name="Label" type="Label" parent="PriceLabel"] +layout_mode = 0 +offset_left = 4.0 +offset_top = 2.0 +offset_right = 152.0 +offset_bottom = 40.0 +theme_override_colors/font_color = Color(0, 0, 0, 1) +text = "dfdsfds +" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="TextureRect" type="TextureButton" parent="."] +layout_mode = 0 +offset_left = -33.0 +offset_top = -23.0 +offset_right = -4.0 +offset_bottom = 6.0 +scale = Vector2(2.32, 2.32) +ignore_texture_size = true +stretch_mode = 0 + +[node name="ClickHandler" type="Node" parent="."] +script = ExtResource("3_h2ml3") +time_to_lock_hover = 0.3 + +[connection signal="gui_input" from="TextureRect" to="ClickHandler" method="_on_gui_input_event"] +[connection signal="mouse_entered" from="TextureRect" to="ClickHandler" method="_on_mouse_entered"] +[connection signal="mouse_exited" from="TextureRect" to="ClickHandler" method="_on_mouse_exited"] diff --git a/Shop/shop_item_relic.gd b/Shop/shop_item_relic.gd new file mode 100644 index 00000000..99e754fb --- /dev/null +++ b/Shop/shop_item_relic.gd @@ -0,0 +1,16 @@ +extends ShopItem + +var relic : Relic +@export var relicImage : TextureButton +@export var clickHandler : ClickHandler + +func _ready() -> void: + var rand : RandomNumberGenerator = RandomNumberGenerator.new() + relic = load(ShopManager.shop_relic_pool[rand.randi_range(0, ShopManager.shop_relic_pool.size() - 1)]) + + relicImage.texture_normal = load(relic.sprite_path) + clickHandler.on_click.connect(on_shop_item_clicked) + super() + +func _give_player_item() -> void: + InventoryManager.relic_component.add_relic(relic) diff --git a/Shop/shop_item_relic.tscn b/Shop/shop_item_relic.tscn new file mode 100644 index 00000000..23ce4f0a --- /dev/null +++ b/Shop/shop_item_relic.tscn @@ -0,0 +1,48 @@ +[gd_scene load_steps=3 format=3 uid="uid://bmklwr3ycyicn"] + +[ext_resource type="Script" path="res://Shop/shop_item_relic.gd" id="1_nhbl5"] +[ext_resource type="Script" path="res://Input/ClickHandler.gd" id="3_lb38f"] + +[node name="ShopItemRelic" type="Control" node_paths=PackedStringArray("relicImage", "clickHandler", "priceLabel")] +layout_mode = 3 +anchors_preset = 0 +script = ExtResource("1_nhbl5") +relicImage = NodePath("TextureRect") +clickHandler = NodePath("ClickHandler") +cost = 20 +priceLabel = NodePath("PriceLabel/Label") + +[node name="PriceLabel" type="ColorRect" parent="."] +layout_mode = 0 +offset_left = -80.0 +offset_top = 55.0 +offset_right = 74.0 +offset_bottom = 95.0 + +[node name="Label" type="Label" parent="PriceLabel"] +layout_mode = 0 +offset_left = 4.0 +offset_top = 2.0 +offset_right = 152.0 +offset_bottom = 40.0 +theme_override_colors/font_color = Color(0, 0, 0, 1) +text = "dfdsfds +" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="TextureRect" type="TextureButton" parent="."] +layout_mode = 0 +offset_left = -45.0 +offset_top = -42.0 +offset_right = -5.0 +offset_bottom = -2.0 +scale = Vector2(2.32, 2.32) + +[node name="ClickHandler" type="Node" parent="."] +script = ExtResource("3_lb38f") +time_to_lock_hover = 0.3 + +[connection signal="gui_input" from="TextureRect" to="ClickHandler" method="_on_gui_input_event"] +[connection signal="mouse_entered" from="TextureRect" to="ClickHandler" method="_on_mouse_entered"] +[connection signal="mouse_exited" from="TextureRect" to="ClickHandler" method="_on_mouse_exited"] diff --git a/Shop/shop_item_torch.gd b/Shop/shop_item_torch.gd new file mode 100644 index 00000000..59d6fbad --- /dev/null +++ b/Shop/shop_item_torch.gd @@ -0,0 +1,33 @@ +extends ShopItem + +@export var clickHandler : ClickHandler +var torchTexture : PackedScene = preload("res://Shop/tourchDisplay.tscn") +@export var amount : int +@export var startPosTransform : Node2D +var heldTorches : Array[TextureRect] + +func _ready() -> void: + clickHandler.on_click.connect(on_shop_item_clicked) + + var startPos : Vector2 = startPosTransform.position + + for i in amount: + var instance : TextureRect = torchTexture.instantiate() + heldTorches.append(instance) + instance.position = startPos + startPos += Vector2.RIGHT * 5 + add_child(instance) + + super() + +func on_shop_item_clicked() ->void: + if(InventoryManager.gold_component.can_afford(cost)): + InventoryManager.gold_component.lose_gold(cost) + _give_player_item() + else: + print("can't afford") + + +func _give_player_item() -> void: + heldTorches.pop_back().queue_free() + InventoryManager.torch_component.add_torches(1) diff --git a/Shop/shop_item_torch.tscn b/Shop/shop_item_torch.tscn new file mode 100644 index 00000000..020bcb03 --- /dev/null +++ b/Shop/shop_item_torch.tscn @@ -0,0 +1,56 @@ +[gd_scene load_steps=4 format=3 uid="uid://tfeo4epmhse0"] + +[ext_resource type="Script" path="res://Shop/shop_item_torch.gd" id="1_u2x56"] +[ext_resource type="Texture2D" uid="uid://nheutko3fha3" path="res://Art/Card_layout/card_border.png" id="2_h1g3t"] +[ext_resource type="Script" path="res://Input/ClickHandler.gd" id="3_4xu5k"] + +[node name="ShopItemTorch" type="Control" node_paths=PackedStringArray("clickHandler", "startPosTransform", "priceLabel")] +layout_mode = 3 +anchors_preset = 0 +script = ExtResource("1_u2x56") +clickHandler = NodePath("ClickHandler") +amount = 110 +startPosTransform = NodePath("StartPos") +cost = 80 +priceLabel = NodePath("PriceLabel/Label") + +[node name="PriceLabel" type="ColorRect" parent="."] +layout_mode = 0 +offset_left = -80.0 +offset_top = 55.0 +offset_right = 74.0 +offset_bottom = 95.0 + +[node name="Label" type="Label" parent="PriceLabel"] +layout_mode = 0 +offset_left = 4.0 +offset_top = 2.0 +offset_right = 152.0 +offset_bottom = 40.0 +theme_override_colors/font_color = Color(0, 0, 0, 1) +text = "dfdsfds +" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="TextureRect" type="TextureButton" parent="."] +layout_mode = 0 +offset_left = -79.0 +offset_top = -23.0 +offset_right = -12.0 +offset_bottom = 3.0 +scale = Vector2(2.32, 2.32) +texture_normal = ExtResource("2_h1g3t") +ignore_texture_size = true +stretch_mode = 0 + +[node name="ClickHandler" type="Node" parent="."] +script = ExtResource("3_4xu5k") +time_to_lock_hover = 0.3 + +[node name="StartPos" type="Node2D" parent="."] +position = Vector2(-95, -33) + +[connection signal="gui_input" from="TextureRect" to="ClickHandler" method="_on_gui_input_event"] +[connection signal="mouse_entered" from="TextureRect" to="ClickHandler" method="_on_mouse_entered"] +[connection signal="mouse_exited" from="TextureRect" to="ClickHandler" method="_on_mouse_exited"] diff --git a/Shop/tourchDisplay.tscn b/Shop/tourchDisplay.tscn new file mode 100644 index 00000000..658f25cd --- /dev/null +++ b/Shop/tourchDisplay.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=2 format=3 uid="uid://babaej81eaepe"] + +[ext_resource type="Texture2D" uid="uid://q8og304npj17" path="res://Art/Items/Tourch.png" id="1_wiop6"] + +[node name="Tourch" type="TextureRect"] +offset_right = 64.0 +offset_bottom = 64.0 +texture = ExtResource("1_wiop6") diff --git a/UI/CardScrollUI.gd b/UI/CardScrollUI.gd index ff1936b5..952d378d 100644 --- a/UI/CardScrollUI.gd +++ b/UI/CardScrollUI.gd @@ -6,6 +6,7 @@ var cards_to_display: Array[CardBase] = [] var card_worlds: Array[CardWorld] = [] var cardworld: CardWorld = null var cardui: Control = null +@onready var button : Button = $Button const CARD_SCALE: Vector2 = Vector2(.7, .7) const CARDUI_INDEX: int = 2 @@ -26,6 +27,8 @@ func _input(_inputevent: InputEvent) -> void: func populate(parent_name: String) -> void: + var cardRemoval : bool = false + match parent_name: "DiscardPile": cards_to_display = CardManager.card_container.discard_pile @@ -36,7 +39,10 @@ func populate(parent_name: String) -> void: "DeckPile": cards_to_display = CardManager.current_deck $Label.text = "Showing the deck pile" - + "CardRemoval": + cards_to_display = CardManager.current_deck + $Label.text = "Pick a card to remove" + cardRemoval = true cards_to_display.sort_custom(card_sort_by_title) for card: CardBase in cards_to_display: @@ -48,11 +54,18 @@ func populate(parent_name: String) -> void: cardui.scale = CARD_SCALE cardui.anchors_preset = CORNER_TOP_LEFT cardui.position = CARDUI_POS + + if(cardRemoval): + cardworld.get_click_handler().on_click.connect(close_card_scroll) + cardworld.get_click_handler().on_click.connect(cardworld.remove_this_from_player_deck_with_price) $ScrollContainer/GridContainer.add_child(cardworld) cardworld.init_card(card) +func close_card_scroll() -> void: + queue_free() + func card_sort_by_title(card_A: CardBase, card_B: CardBase) -> bool: if card_A.card_title.to_lower() < card_B.card_title.to_lower(): return true diff --git a/project.godot b/project.godot index 45e3094c..ccdc226c 100644 --- a/project.godot +++ b/project.godot @@ -34,6 +34,7 @@ MapManager="*res://Managers/MapManager.gd" InventoryManager="*res://Managers/InventoryManager.gd" DialogueManager="*res://addons/dialogue_manager/dialogue_manager.gd" XpManager="*res://Managers/XpManager.gd" +ShopManager="*res://Managers/ShopManager.gd" [debug] From c0b92530e5062db04891f13906f5873b97100af0 Mon Sep 17 00:00:00 2001 From: Jona Lam <89871543+JonaLam@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:11:14 +0100 Subject: [PATCH 03/12] fixed nameing --- #Scenes/Events/shop/0.tscn | 4 ++-- #Scenes/TestingScene.tscn | 4 ++-- .../{CatTree.png => 0-0.test.CatTree.png} | Bin ...tTree.png.import => 0-0.test.CatTree.png.import} | 6 +++--- Art/{Items/Tourch.png => Menus/Tourch-1.png} | Bin .../Tourch.png.import => Menus/Tourch-1.png.import} | 6 +++--- Art/{Background/Trash.png => Menus/Trash-1.png} | Bin .../Trash.png.import => Menus/Trash-1.png.import} | 6 +++--- Shop/tourchDisplay.tscn | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) rename Art/Background/{CatTree.png => 0-0.test.CatTree.png} (100%) rename Art/Background/{CatTree.png.import => 0-0.test.CatTree.png.import} (69%) rename Art/{Items/Tourch.png => Menus/Tourch-1.png} (100%) rename Art/{Items/Tourch.png.import => Menus/Tourch-1.png.import} (72%) rename Art/{Background/Trash.png => Menus/Trash-1.png} (100%) rename Art/{Background/Trash.png.import => Menus/Trash-1.png.import} (72%) diff --git a/#Scenes/Events/shop/0.tscn b/#Scenes/Events/shop/0.tscn index c456706a..1a8ef989 100644 --- a/#Scenes/Events/shop/0.tscn +++ b/#Scenes/Events/shop/0.tscn @@ -3,12 +3,12 @@ [ext_resource type="PackedScene" uid="uid://bam77cwf4emyr" path="res://#Scenes/TopBarOverlay.tscn" id="1_7gwvp"] [ext_resource type="Script" path="res://#Scenes/SceneScripts/ShopScene.gd" id="1_u1m6k"] [ext_resource type="PackedScene" uid="uid://cdt4k2reymt2i" path="res://Shop/shop_item_card.tscn" id="4_bbct0"] -[ext_resource type="Texture2D" uid="uid://c6fmkrnbs4mf6" path="res://Art/Background/CatTree.png" id="6_ppjdl"] +[ext_resource type="Texture2D" uid="uid://c6fmkrnbs4mf6" path="res://Art/Background/0-0.test.CatTree.png" id="6_ppjdl"] [ext_resource type="PackedScene" uid="uid://bmklwr3ycyicn" path="res://Shop/shop_item_relic.tscn" id="8_i0gsy"] [ext_resource type="PackedScene" uid="uid://c4bsmddaua2ye" path="res://Shop/shop_item_consumable.tscn" id="10_jre48"] [ext_resource type="PackedScene" uid="uid://tfeo4epmhse0" path="res://Shop/shop_item_torch.tscn" id="11_3t8vb"] [ext_resource type="Script" path="res://#Scenes/Events/shop/CardRemoval.gd" id="12_1uxnd"] -[ext_resource type="Texture2D" uid="uid://dd06ocktximw7" path="res://Art/Background/Trash.png" id="12_yofyg"] +[ext_resource type="Texture2D" uid="uid://dd06ocktximw7" path="res://Art/Menus/Trash-1.png" id="12_yofyg"] [node name="Control" type="Control"] layout_mode = 3 diff --git a/#Scenes/TestingScene.tscn b/#Scenes/TestingScene.tscn index 2ced87a5..1cd2bdfa 100644 --- a/#Scenes/TestingScene.tscn +++ b/#Scenes/TestingScene.tscn @@ -11,9 +11,9 @@ [ext_resource type="Texture2D" uid="uid://caemucaya30wh" path="res://Art/Card_layout/draw_pile.png" id="11_pw70x"] [ext_resource type="Texture2D" uid="uid://d4muqvs3etnr8" path="res://Art/Card_layout/discard_pile.png" id="12_kxw48"] [ext_resource type="Script" path="res://UI/EndTurnButton.gd" id="14_dpe64"] -[ext_resource type="PackedScene" path="res://#Scenes/TopBarOverlay.tscn" id="14_e54tj"] +[ext_resource type="PackedScene" uid="uid://bam77cwf4emyr" path="res://#Scenes/TopBarOverlay.tscn" id="14_e54tj"] [ext_resource type="Script" path="res://UI/EnergyLabel.gd" id="14_nckre"] -[ext_resource type="Resource" path="res://Items/test_relic.tres" id="19_prw12"] +[ext_resource type="Resource" uid="uid://c5fh7bnfh3l4u" path="res://Items/test_relic.tres" id="19_prw12"] [ext_resource type="Texture2D" uid="uid://bl5v3bgnntoc5" path="res://Art/Card_layout/energy_count.png" id="19_spyxg"] [sub_resource type="GDScript" id="GDScript_g5yv1"] diff --git a/Art/Background/CatTree.png b/Art/Background/0-0.test.CatTree.png similarity index 100% rename from Art/Background/CatTree.png rename to Art/Background/0-0.test.CatTree.png diff --git a/Art/Background/CatTree.png.import b/Art/Background/0-0.test.CatTree.png.import similarity index 69% rename from Art/Background/CatTree.png.import rename to Art/Background/0-0.test.CatTree.png.import index 3b33f982..b1c72614 100644 --- a/Art/Background/CatTree.png.import +++ b/Art/Background/0-0.test.CatTree.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://c6fmkrnbs4mf6" -path="res://.godot/imported/CatTree.png-d58f5c3bb4506352afe76dd76a5fa527.ctex" +path="res://.godot/imported/0-0.test.CatTree.png-85c2a2ddf3b5a611c2c6d4f74b8e8a51.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://Art/Background/CatTree.png" -dest_files=["res://.godot/imported/CatTree.png-d58f5c3bb4506352afe76dd76a5fa527.ctex"] +source_file="res://Art/Background/0-0.test.CatTree.png" +dest_files=["res://.godot/imported/0-0.test.CatTree.png-85c2a2ddf3b5a611c2c6d4f74b8e8a51.ctex"] [params] diff --git a/Art/Items/Tourch.png b/Art/Menus/Tourch-1.png similarity index 100% rename from Art/Items/Tourch.png rename to Art/Menus/Tourch-1.png diff --git a/Art/Items/Tourch.png.import b/Art/Menus/Tourch-1.png.import similarity index 72% rename from Art/Items/Tourch.png.import rename to Art/Menus/Tourch-1.png.import index 1ff1a866..fd636f88 100644 --- a/Art/Items/Tourch.png.import +++ b/Art/Menus/Tourch-1.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://q8og304npj17" -path="res://.godot/imported/Tourch.png-94c708f8cbc15c61a8fc8ebd4d244dbc.ctex" +path="res://.godot/imported/Tourch-1.png-725c85a730fc6605077802284887b207.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://Art/Items/Tourch.png" -dest_files=["res://.godot/imported/Tourch.png-94c708f8cbc15c61a8fc8ebd4d244dbc.ctex"] +source_file="res://Art/Menus/Tourch-1.png" +dest_files=["res://.godot/imported/Tourch-1.png-725c85a730fc6605077802284887b207.ctex"] [params] diff --git a/Art/Background/Trash.png b/Art/Menus/Trash-1.png similarity index 100% rename from Art/Background/Trash.png rename to Art/Menus/Trash-1.png diff --git a/Art/Background/Trash.png.import b/Art/Menus/Trash-1.png.import similarity index 72% rename from Art/Background/Trash.png.import rename to Art/Menus/Trash-1.png.import index 9bd88e0d..f46e93db 100644 --- a/Art/Background/Trash.png.import +++ b/Art/Menus/Trash-1.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://dd06ocktximw7" -path="res://.godot/imported/Trash.png-b76c4a8e7231dce5a7a6c2092684f711.ctex" +path="res://.godot/imported/Trash-1.png-ce07c71134e16d0aecc8b7d0db00fb11.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://Art/Background/Trash.png" -dest_files=["res://.godot/imported/Trash.png-b76c4a8e7231dce5a7a6c2092684f711.ctex"] +source_file="res://Art/Menus/Trash-1.png" +dest_files=["res://.godot/imported/Trash-1.png-ce07c71134e16d0aecc8b7d0db00fb11.ctex"] [params] diff --git a/Shop/tourchDisplay.tscn b/Shop/tourchDisplay.tscn index 658f25cd..ed08e74b 100644 --- a/Shop/tourchDisplay.tscn +++ b/Shop/tourchDisplay.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=2 format=3 uid="uid://babaej81eaepe"] -[ext_resource type="Texture2D" uid="uid://q8og304npj17" path="res://Art/Items/Tourch.png" id="1_wiop6"] +[ext_resource type="Texture2D" uid="uid://q8og304npj17" path="res://Art/Menus/Tourch-1.png" id="1_4ar2h"] [node name="Tourch" type="TextureRect"] offset_right = 64.0 offset_bottom = 64.0 -texture = ExtResource("1_wiop6") +texture = ExtResource("1_4ar2h") From 595c1f453ad83f270eed4c8afcf117d4530b225e Mon Sep 17 00:00:00 2001 From: Jona Lam <89871543+JonaLam@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:24:02 +0100 Subject: [PATCH 04/12] Moved the autoload to a scene --- Managers/ShopManager.gd | 8 +++----- Shop/ShopItemCard.gd | 2 +- Shop/shop_item_consumable.gd | 2 +- Shop/shop_item_relic.gd | 2 +- project.godot | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Managers/ShopManager.gd b/Managers/ShopManager.gd index 52e906b9..db7adc3a 100644 --- a/Managers/ShopManager.gd +++ b/Managers/ShopManager.gd @@ -6,15 +6,13 @@ var card_removal_price : int = 50 var card_remocal_price_increase : int = 25 ## the item pools for the various things provided in the shop[br] -## the items are loaded when taken so all that is needed here are strings to the items -var shop_card_pool : Array = ["res://Cards/Resource/Card_Damage.tres", "res://Cards/Resource/Card_DamageAllEnemies.tres"] -var shop_relic_pool : Array = ["res://Items/test_relic.tres", "res://Items/test_relic_2.tres"] -var shop_consumable_pool : Array = ["res://Items/test_consumable.tres","res://Items/test_consumable_2.tres"] +@export var shop_card_pool : Array +@export var shop_relic_pool : Array +@export var shop_consumable_pool : Array func increase_removal_price() -> void: card_removal_price += card_remocal_price_increase - ## Removes given card, takes money, and increases shop prices. Should only be used by the shop removal[br] ## or potentionaly a specific event func remove_card_from_player_deck_with_price(card : CardBase) -> void: diff --git a/Shop/ShopItemCard.gd b/Shop/ShopItemCard.gd index eb705b6a..552057de 100644 --- a/Shop/ShopItemCard.gd +++ b/Shop/ShopItemCard.gd @@ -5,7 +5,7 @@ var card : CardBase func _ready() -> void: var rand : RandomNumberGenerator = RandomNumberGenerator.new() - card = load(ShopManager.shop_card_pool[rand.randi_range(0, ShopManager.shop_card_pool.size() - 1)]) + card = ShopManager.shop_card_pool[rand.randi_range(0, ShopManager.shop_card_pool.size() - 1)] cardWorld.init_card(card) cardWorld.get_click_handler().on_click.connect(on_shop_item_clicked) diff --git a/Shop/shop_item_consumable.gd b/Shop/shop_item_consumable.gd index 7c95ece1..4ecb795a 100644 --- a/Shop/shop_item_consumable.gd +++ b/Shop/shop_item_consumable.gd @@ -7,7 +7,7 @@ var consumable : Consumable func _ready() -> void: var rand : RandomNumberGenerator = RandomNumberGenerator.new() - consumable = load(ShopManager.shop_consumable_pool[rand.randi_range(0, ShopManager.shop_consumable_pool.size() - 1)]) + consumable = ShopManager.shop_consumable_pool[rand.randi_range(0, ShopManager.shop_consumable_pool.size() - 1)] consumableImage.texture_normal = load(consumable.image_path) diff --git a/Shop/shop_item_relic.gd b/Shop/shop_item_relic.gd index 99e754fb..80056cff 100644 --- a/Shop/shop_item_relic.gd +++ b/Shop/shop_item_relic.gd @@ -6,7 +6,7 @@ var relic : Relic func _ready() -> void: var rand : RandomNumberGenerator = RandomNumberGenerator.new() - relic = load(ShopManager.shop_relic_pool[rand.randi_range(0, ShopManager.shop_relic_pool.size() - 1)]) + relic = ShopManager.shop_relic_pool[rand.randi_range(0, ShopManager.shop_relic_pool.size() - 1)] relicImage.texture_normal = load(relic.sprite_path) clickHandler.on_click.connect(on_shop_item_clicked) diff --git a/project.godot b/project.godot index ccdc226c..116b34dc 100644 --- a/project.godot +++ b/project.godot @@ -34,7 +34,7 @@ MapManager="*res://Managers/MapManager.gd" InventoryManager="*res://Managers/InventoryManager.gd" DialogueManager="*res://addons/dialogue_manager/dialogue_manager.gd" XpManager="*res://Managers/XpManager.gd" -ShopManager="*res://Managers/ShopManager.gd" +ShopManager="*res://Shop/ShopManager.tscn" [debug] From be352866517e47511f1c53b1b997bd7f8258cceb Mon Sep 17 00:00:00 2001 From: Jona Lam <89871543+JonaLam@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:28:39 +0100 Subject: [PATCH 05/12] Added checks if things can be done --- Cards/CardWorld.gd | 3 +++ Managers/ShopManager.gd | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Cards/CardWorld.gd b/Cards/CardWorld.gd index f3b6f969..8fa5413e 100644 --- a/Cards/CardWorld.gd +++ b/Cards/CardWorld.gd @@ -26,6 +26,9 @@ func init_card(in_card_data: CardBase) -> void: ## takes money and increases price of shop removal, should only be used when this is wanted func remove_this_from_player_deck_with_price() -> void: + if(!InventoryManager.gold_component.can_afford(ShopManager.card_removal_price)): + return + ShopManager.remove_card_from_player_deck_with_price(card_data) ## this should be used most of the time we want to take a card from the player diff --git a/Managers/ShopManager.gd b/Managers/ShopManager.gd index db7adc3a..7dda971b 100644 --- a/Managers/ShopManager.gd +++ b/Managers/ShopManager.gd @@ -16,6 +16,9 @@ func increase_removal_price() -> void: ## Removes given card, takes money, and increases shop prices. Should only be used by the shop removal[br] ## or potentionaly a specific event func remove_card_from_player_deck_with_price(card : CardBase) -> void: + if(!InventoryManager.gold_component.can_afford(ShopManager.card_removal_price)): + return + CardManager.current_deck.erase(card) InventoryManager.gold_component.lose_gold(card_removal_price) increase_removal_price() From 7a669578fe2a9b089a69929662f7c11e463a4623 Mon Sep 17 00:00:00 2001 From: Jona Lam <89871543+JonaLam@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:34:43 +0100 Subject: [PATCH 06/12] Moved script --- #Scenes/Events/shop/0.tscn | 2 +- #Scenes/{Events/shop => SceneScripts}/CardRemoval.gd | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename #Scenes/{Events/shop => SceneScripts}/CardRemoval.gd (100%) diff --git a/#Scenes/Events/shop/0.tscn b/#Scenes/Events/shop/0.tscn index 1a8ef989..f36fa4cb 100644 --- a/#Scenes/Events/shop/0.tscn +++ b/#Scenes/Events/shop/0.tscn @@ -7,7 +7,7 @@ [ext_resource type="PackedScene" uid="uid://bmklwr3ycyicn" path="res://Shop/shop_item_relic.tscn" id="8_i0gsy"] [ext_resource type="PackedScene" uid="uid://c4bsmddaua2ye" path="res://Shop/shop_item_consumable.tscn" id="10_jre48"] [ext_resource type="PackedScene" uid="uid://tfeo4epmhse0" path="res://Shop/shop_item_torch.tscn" id="11_3t8vb"] -[ext_resource type="Script" path="res://#Scenes/Events/shop/CardRemoval.gd" id="12_1uxnd"] +[ext_resource type="Script" path="res://#Scenes/SceneScripts/CardRemoval.gd" id="12_1uxnd"] [ext_resource type="Texture2D" uid="uid://dd06ocktximw7" path="res://Art/Menus/Trash-1.png" id="12_yofyg"] [node name="Control" type="Control"] diff --git a/#Scenes/Events/shop/CardRemoval.gd b/#Scenes/SceneScripts/CardRemoval.gd similarity index 100% rename from #Scenes/Events/shop/CardRemoval.gd rename to #Scenes/SceneScripts/CardRemoval.gd From 80b5b80483c1ef538f866fb738af910ef17a5fff Mon Sep 17 00:00:00 2001 From: Jona Lam <89871543+JonaLam@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:44:08 +0100 Subject: [PATCH 07/12] fixed rng --- Managers/RandomGenerator.gd | 7 ++++++- Shop/ShopItemCard.gd | 3 +-- Shop/ShopManager.tscn | 17 +++++++++++++++++ Shop/shop_item_consumable.gd | 3 +-- Shop/shop_item_relic.gd | 3 +-- 5 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 Shop/ShopManager.tscn diff --git a/Managers/RandomGenerator.gd b/Managers/RandomGenerator.gd index 4d421be3..417c6f46 100644 --- a/Managers/RandomGenerator.gd +++ b/Managers/RandomGenerator.gd @@ -5,10 +5,12 @@ extends Node # Set this to a value other than -1 to have deterministic randomness. # Make sure to set back to -1 when done testing! const GAME_SEED = -1 - +var randomNumberGenerator : RandomNumberGenerator func _ready() -> void: set_game_seed(GAME_SEED) + randomNumberGenerator = RandomNumberGenerator.new() + randomNumberGenerator.seed = GAME_SEED func set_game_seed(given_seed: int = -1) -> void: @@ -18,3 +20,6 @@ func set_game_seed(given_seed: int = -1) -> void: seed(set_seed) print("Seed set to: " + str(set_seed)) + +func get_random_int(min: int, max: int) -> int: + return randomNumberGenerator.randi_range(min, max) diff --git a/Shop/ShopItemCard.gd b/Shop/ShopItemCard.gd index 552057de..4188b7c9 100644 --- a/Shop/ShopItemCard.gd +++ b/Shop/ShopItemCard.gd @@ -4,8 +4,7 @@ extends ShopItem var card : CardBase func _ready() -> void: - var rand : RandomNumberGenerator = RandomNumberGenerator.new() - card = ShopManager.shop_card_pool[rand.randi_range(0, ShopManager.shop_card_pool.size() - 1)] + card = ShopManager.shop_card_pool[RandomGenerator.get_random_int(0, ShopManager.shop_card_pool.size() - 1)] cardWorld.init_card(card) cardWorld.get_click_handler().on_click.connect(on_shop_item_clicked) diff --git a/Shop/ShopManager.tscn b/Shop/ShopManager.tscn new file mode 100644 index 00000000..7e5a18d4 --- /dev/null +++ b/Shop/ShopManager.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=10 format=3 uid="uid://cunr4wwabqn1u"] + +[ext_resource type="Script" path="res://Managers/ShopManager.gd" id="1_rqenh"] +[ext_resource type="Resource" uid="uid://ckaua56xmrxib" path="res://Cards/Resource/Card_Energy.tres" id="2_bi5vb"] +[ext_resource type="Resource" uid="uid://bdjkrhy06ijb7" path="res://Cards/Resource/Card_PoisonRandom.tres" id="3_m7u3s"] +[ext_resource type="Resource" uid="uid://btj36bhn3n2tr" path="res://Cards/Resource/Card_Strength.tres" id="4_0e1wy"] +[ext_resource type="Resource" uid="uid://b4kmg3lm0e45q" path="res://Cards/Resource/Card_Vulnerability.tres" id="5_hech8"] +[ext_resource type="Resource" uid="uid://c5fh7bnfh3l4u" path="res://Items/test_relic.tres" id="6_whv6x"] +[ext_resource type="Resource" uid="uid://cu4gaxrv2jn81" path="res://Items/test_relic_2.tres" id="7_5msik"] +[ext_resource type="Resource" uid="uid://m8lhbvw2gawd" path="res://Items/test_consumable.tres" id="8_8fhko"] +[ext_resource type="Resource" uid="uid://qclftsxybsw" path="res://Items/test_consumable_2.tres" id="9_j2l7g"] + +[node name="ShopManager" type="Node"] +script = ExtResource("1_rqenh") +shop_card_pool = [ExtResource("2_bi5vb"), ExtResource("3_m7u3s"), ExtResource("4_0e1wy"), ExtResource("5_hech8")] +shop_relic_pool = [ExtResource("6_whv6x"), ExtResource("7_5msik")] +shop_consumable_pool = [ExtResource("8_8fhko"), ExtResource("9_j2l7g")] diff --git a/Shop/shop_item_consumable.gd b/Shop/shop_item_consumable.gd index 4ecb795a..9576f090 100644 --- a/Shop/shop_item_consumable.gd +++ b/Shop/shop_item_consumable.gd @@ -6,8 +6,7 @@ var consumable : Consumable func _ready() -> void: - var rand : RandomNumberGenerator = RandomNumberGenerator.new() - consumable = ShopManager.shop_consumable_pool[rand.randi_range(0, ShopManager.shop_consumable_pool.size() - 1)] + consumable = ShopManager.shop_consumable_pool[RandomGenerator.get_random_int(0, ShopManager.shop_consumable_pool.size() - 1)] consumableImage.texture_normal = load(consumable.image_path) diff --git a/Shop/shop_item_relic.gd b/Shop/shop_item_relic.gd index 80056cff..8827b16c 100644 --- a/Shop/shop_item_relic.gd +++ b/Shop/shop_item_relic.gd @@ -5,8 +5,7 @@ var relic : Relic @export var clickHandler : ClickHandler func _ready() -> void: - var rand : RandomNumberGenerator = RandomNumberGenerator.new() - relic = ShopManager.shop_relic_pool[rand.randi_range(0, ShopManager.shop_relic_pool.size() - 1)] + relic = ShopManager.shop_relic_pool[RandomGenerator.get_random_int(0, ShopManager.shop_relic_pool.size() - 1)] relicImage.texture_normal = load(relic.sprite_path) clickHandler.on_click.connect(on_shop_item_clicked) From b3b6044733df69439ecf38c0f738c0b38a77e812 Mon Sep 17 00:00:00 2001 From: Jona Lam <89871543+JonaLam@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:48:03 +0100 Subject: [PATCH 08/12] added debug var --- Global/DEBUG_VAR.gd | 3 +++ Managers/InventoryManager.gd | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/Global/DEBUG_VAR.gd b/Global/DEBUG_VAR.gd index b95e7067..6c16a60e 100644 --- a/Global/DEBUG_VAR.gd +++ b/Global/DEBUG_VAR.gd @@ -19,3 +19,6 @@ const DEBUG_ACTIVE_INVENTORY_DEBUG_BUTTONS : bool = false ## Temporary debug option to print the number of each generated event type [br] ## TO BE REMOVED after implmentation const DEBUG_PRINT_EVENT_COUNT : bool = false + +## Makes player start with a lot of gold +const DEBUG_START_WITH_A_LOT_OF_GOLD : bool = false diff --git a/Managers/InventoryManager.gd b/Managers/InventoryManager.gd index ef7993b9..09332827 100644 --- a/Managers/InventoryManager.gd +++ b/Managers/InventoryManager.gd @@ -15,6 +15,10 @@ var relic_component : InventoryRelicComponent = InventoryRelicComponent.new() var inventory_HUD : PackedScene = preload("res://InventoryComponents/InventoryHUD/inventory_hud.tscn") var instanced_inventory_HUD : Node +func _ready() -> void: + if(DebugVar.DEBUG_START_WITH_A_LOT_OF_GOLD): + gold_component.add_gold(999999999) + func instance_inventory_HUD() -> void: instanced_inventory_HUD = inventory_HUD.instantiate() get_tree().current_scene.add_child(instanced_inventory_HUD) @@ -43,6 +47,10 @@ func subtract_torch() -> void: func init_data() -> void: close_inventory_HUD() gold_component = InventoryGoldComponent.new() + + if(DebugVar.DEBUG_START_WITH_A_LOT_OF_GOLD): + gold_component.add_gold(999999999) + torch_component = InventoryTorchComponent.new() consumable_component = InventoryConsumablesComponent.new() relic_component = InventoryRelicComponent.new() From 15f102233f21295c770510ac1a80e87600a0c826 Mon Sep 17 00:00:00 2001 From: Jona Lam <89871543+JonaLam@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:59:46 +0100 Subject: [PATCH 09/12] Renamed typo --- Art/Menus/{Tourch-1.png => Torch-1.png} | Bin .../{Tourch-1.png.import => Torch-1.png.import} | 6 +++--- Shop/torchDisplay.tscn | 8 ++++++++ Shop/tourchDisplay.tscn | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) rename Art/Menus/{Tourch-1.png => Torch-1.png} (100%) rename Art/Menus/{Tourch-1.png.import => Torch-1.png.import} (72%) create mode 100644 Shop/torchDisplay.tscn diff --git a/Art/Menus/Tourch-1.png b/Art/Menus/Torch-1.png similarity index 100% rename from Art/Menus/Tourch-1.png rename to Art/Menus/Torch-1.png diff --git a/Art/Menus/Tourch-1.png.import b/Art/Menus/Torch-1.png.import similarity index 72% rename from Art/Menus/Tourch-1.png.import rename to Art/Menus/Torch-1.png.import index fd636f88..2bd0e6a5 100644 --- a/Art/Menus/Tourch-1.png.import +++ b/Art/Menus/Torch-1.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://q8og304npj17" -path="res://.godot/imported/Tourch-1.png-725c85a730fc6605077802284887b207.ctex" +path="res://.godot/imported/Torch-1.png-83e2f1112a740f117332d625f3e72da4.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://Art/Menus/Tourch-1.png" -dest_files=["res://.godot/imported/Tourch-1.png-725c85a730fc6605077802284887b207.ctex"] +source_file="res://Art/Menus/Torch-1.png" +dest_files=["res://.godot/imported/Torch-1.png-83e2f1112a740f117332d625f3e72da4.ctex"] [params] diff --git a/Shop/torchDisplay.tscn b/Shop/torchDisplay.tscn new file mode 100644 index 00000000..a96e7a01 --- /dev/null +++ b/Shop/torchDisplay.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=2 format=3 uid="uid://cfi6n74tteqoa"] + +[ext_resource type="Texture2D" uid="uid://q8og304npj17" path="res://Art/Menus/Torch-1.png" id="1_ibery"] + +[node name="Tourch" type="TextureRect"] +offset_right = 64.0 +offset_bottom = 64.0 +texture = ExtResource("1_ibery") diff --git a/Shop/tourchDisplay.tscn b/Shop/tourchDisplay.tscn index ed08e74b..1be0046b 100644 --- a/Shop/tourchDisplay.tscn +++ b/Shop/tourchDisplay.tscn @@ -1,6 +1,6 @@ -[gd_scene load_steps=2 format=3 uid="uid://babaej81eaepe"] +[gd_scene load_steps=2 format=3 uid="uid://bk6mqnadig71r"] -[ext_resource type="Texture2D" uid="uid://q8og304npj17" path="res://Art/Menus/Tourch-1.png" id="1_4ar2h"] +[ext_resource type="Texture2D" uid="uid://q8og304npj17" path="res://Art/Menus/Torch-1.png" id="1_4ar2h"] [node name="Tourch" type="TextureRect"] offset_right = 64.0 From 6bf319030f038c01e93638267c1602ef34cf14ad Mon Sep 17 00:00:00 2001 From: Jona Lam <89871543+JonaLam@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:01:30 +0100 Subject: [PATCH 10/12] Commented code --- Shop/shop_item_torch.gd | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Shop/shop_item_torch.gd b/Shop/shop_item_torch.gd index 59d6fbad..a8fc3782 100644 --- a/Shop/shop_item_torch.gd +++ b/Shop/shop_item_torch.gd @@ -11,11 +11,16 @@ func _ready() -> void: var startPos : Vector2 = startPosTransform.position + ## Instansiates the amount of torches held in this item. [br] + ## Each torch is moved a set distance away from the last for i in amount: var instance : TextureRect = torchTexture.instantiate() heldTorches.append(instance) instance.position = startPos - startPos += Vector2.RIGHT * 5 + + var torch_distance : float = 5 + + startPos += Vector2.RIGHT * torch_distance add_child(instance) super() From 0f2360af67c50bdb483f481e7b5e1df3d35edfb4 Mon Sep 17 00:00:00 2001 From: Jona Lam <89871543+JonaLam@users.noreply.github.com> Date: Thu, 19 Dec 2024 01:30:24 +0100 Subject: [PATCH 11/12] Delete 0.t1104.tmp --- #Scenes/Events/shop/0.t1104.tmp | 37 --------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 #Scenes/Events/shop/0.t1104.tmp diff --git a/#Scenes/Events/shop/0.t1104.tmp b/#Scenes/Events/shop/0.t1104.tmp deleted file mode 100644 index e1116b87..00000000 --- a/#Scenes/Events/shop/0.t1104.tmp +++ /dev/null @@ -1,37 +0,0 @@ -[gd_scene load_steps=8 format=3 uid="uid://b8hbst1klk5ng"] - -[ext_resource type="PackedScene" uid="uid://bam77cwf4emyr" path="res://#Scenes/TopBarOverlay.tscn" id="1_7gwvp"] -[ext_resource type="Script" path="res://#Scenes/SceneScripts/ShopScene.gd" id="1_u1m6k"] -[ext_resource type="Resource" uid="uid://uv2rili0xf3x" path="res://Cards/Resource/Card_Damage_EVERYTHING.tres" id="2_u60ec"] -[ext_resource type="Texture2D" uid="uid://bo0j1ve4n2ni7" path="res://Art/Background/Shop_Background.png" id="3_6osfu"] -[ext_resource type="Resource" uid="uid://d4lugn62mmlep" path="res://Cards/Resource/Card_DrawCards.tres" id="3_trwis"] -[ext_resource type="PackedScene" uid="uid://cdt4k2reymt2i" path="res://Shop/shop_item.tscn" id="4_bbct0"] -[ext_resource type="Resource" uid="uid://0x385c3nuq8f" path="res://Cards/Resource/Card_DamageAllEnemies.tres" id="4_e4vp7"] - -[node name="Control" type="Control"] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -script = ExtResource("1_u1m6k") -cardPool = Array[Object]([ExtResource("2_u60ec"), ExtResource("3_trwis"), ExtResource("4_e4vp7")]) - -[node name="TopBarOverlay" parent="." instance=ExtResource("1_7gwvp")] -layout_mode = 1 - -[node name="TextureRect" type="TextureRect" parent="."] -layout_mode = 0 -offset_left = 20.0 -offset_top = 16.0 -offset_right = 1068.0 -offset_bottom = 1064.0 -texture = ExtResource("3_6osfu") -expand_mode = 1 - -[node name="ShopItem" parent="." instance=ExtResource("4_bbct0")] -offset_left = 216.0 -offset_top = 252.0 -offset_right = 216.0 -offset_bottom = 252.0 From 54a8f62cf8553d66daaf493f29230a96d620cba9 Mon Sep 17 00:00:00 2001 From: Jona Lam <89871543+JonaLam@users.noreply.github.com> Date: Thu, 19 Dec 2024 02:01:08 +0100 Subject: [PATCH 12/12] Fixed Card removal UI --- #Scenes/Events/shop/0.tscn | 65 +---------------------------- #Scenes/SceneScripts/CardRemoval.gd | 3 +- #Scenes/SceneScripts/ShopScene.gd | 18 +++++--- 3 files changed, 16 insertions(+), 70 deletions(-) diff --git a/#Scenes/Events/shop/0.tscn b/#Scenes/Events/shop/0.tscn index f36fa4cb..01d192c2 100644 --- a/#Scenes/Events/shop/0.tscn +++ b/#Scenes/Events/shop/0.tscn @@ -1,11 +1,9 @@ -[gd_scene load_steps=10 format=3 uid="uid://b8hbst1klk5ng"] +[gd_scene load_steps=8 format=3 uid="uid://b8hbst1klk5ng"] [ext_resource type="PackedScene" uid="uid://bam77cwf4emyr" path="res://#Scenes/TopBarOverlay.tscn" id="1_7gwvp"] [ext_resource type="Script" path="res://#Scenes/SceneScripts/ShopScene.gd" id="1_u1m6k"] [ext_resource type="PackedScene" uid="uid://cdt4k2reymt2i" path="res://Shop/shop_item_card.tscn" id="4_bbct0"] [ext_resource type="Texture2D" uid="uid://c6fmkrnbs4mf6" path="res://Art/Background/0-0.test.CatTree.png" id="6_ppjdl"] -[ext_resource type="PackedScene" uid="uid://bmklwr3ycyicn" path="res://Shop/shop_item_relic.tscn" id="8_i0gsy"] -[ext_resource type="PackedScene" uid="uid://c4bsmddaua2ye" path="res://Shop/shop_item_consumable.tscn" id="10_jre48"] [ext_resource type="PackedScene" uid="uid://tfeo4epmhse0" path="res://Shop/shop_item_torch.tscn" id="11_3t8vb"] [ext_resource type="Script" path="res://#Scenes/SceneScripts/CardRemoval.gd" id="12_1uxnd"] [ext_resource type="Texture2D" uid="uid://dd06ocktximw7" path="res://Art/Menus/Trash-1.png" id="12_yofyg"] @@ -15,10 +13,6 @@ layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = 41.0 -offset_top = -11.0 -offset_right = 41.0 -offset_bottom = -11.0 grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_u1m6k") @@ -61,52 +55,6 @@ offset_top = 414.0 offset_right = 891.0 offset_bottom = 414.0 -[node name="Item" type="Control" parent="ShopItems"] -anchors_preset = 0 -offset_right = 40.0 -offset_bottom = 40.0 - -[node name="ShopItemItem" parent="ShopItems/Item" instance=ExtResource("8_i0gsy")] -offset_left = 183.0 -offset_top = 904.0 -offset_right = 183.0 -offset_bottom = 904.0 - -[node name="ShopItemItem2" parent="ShopItems/Item" instance=ExtResource("8_i0gsy")] -offset_left = 363.0 -offset_top = 901.0 -offset_right = 363.0 -offset_bottom = 901.0 - -[node name="ShopItem" parent="ShopItems/Item" instance=ExtResource("8_i0gsy")] -offset_left = 552.0 -offset_top = 906.0 -offset_right = 552.0 -offset_bottom = 906.0 - -[node name="Consumables" type="Control" parent="ShopItems"] -anchors_preset = 0 -offset_right = 40.0 -offset_bottom = 40.0 - -[node name="ShopItemConsumable" parent="ShopItems/Consumables" instance=ExtResource("10_jre48")] -offset_left = 257.0 -offset_top = 113.0 -offset_right = 257.0 -offset_bottom = 113.0 - -[node name="ShopItemConsumable2" parent="ShopItems/Consumables" instance=ExtResource("10_jre48")] -offset_left = 472.0 -offset_top = 117.0 -offset_right = 472.0 -offset_bottom = 117.0 - -[node name="ShopItemConsumable3" parent="ShopItems/Consumables" instance=ExtResource("10_jre48")] -offset_left = 650.0 -offset_top = 107.0 -offset_right = 650.0 -offset_bottom = 107.0 - [node name="CardRemoval" type="TextureButton" parent="ShopItems"] layout_mode = 1 anchors_preset = -1 @@ -161,14 +109,3 @@ offset_bottom = 1111.0 mouse_filter = 2 texture = ExtResource("6_ppjdl") expand_mode = 1 - -[node name="Button" type="Button" parent="."] -layout_mode = 0 -offset_left = 1352.0 -offset_top = 226.0 -offset_right = 1815.0 -offset_bottom = 392.0 -theme_override_font_sizes/font_size = 116 -text = "Proceed" - -[connection signal="pressed" from="Button" to="." method="_on_button_pressed"] diff --git a/#Scenes/SceneScripts/CardRemoval.gd b/#Scenes/SceneScripts/CardRemoval.gd index f0305c08..f682041f 100644 --- a/#Scenes/SceneScripts/CardRemoval.gd +++ b/#Scenes/SceneScripts/CardRemoval.gd @@ -1,6 +1,7 @@ extends CardPileUISetter @onready var priceText : Label = $CardRemoval/ColorRect/Label +@onready var sceneRoot : Node = $"../.." func _ready() -> void: priceText.text = str(ShopManager.card_removal_price) @@ -14,7 +15,7 @@ func _pressed() -> void: var uiPile: Control = cardUI.instantiate() uiPile.populate(get_name()) - parent.add_child(uiPile) + sceneRoot.add_child(uiPile) queue_free() func _on_button_pressed() -> void: diff --git a/#Scenes/SceneScripts/ShopScene.gd b/#Scenes/SceneScripts/ShopScene.gd index 73c33116..dd5b6385 100644 --- a/#Scenes/SceneScripts/ShopScene.gd +++ b/#Scenes/SceneScripts/ShopScene.gd @@ -2,12 +2,20 @@ extends Control class_name ShopScene func _ready() -> void: + + # This code has to happen after the map has done '.on_event_started' [br] + # so I just put a .1 delay on it + var timer : SceneTreeTimer = get_tree().create_timer(0.1) + timer.timeout.connect(_on_start_with_delay) + + +## This code has to happen after the map has done '.on_event_started' [br] +## so I just put a .1 delay on it +func _on_start_with_delay() -> void: SaveManager.execute_save() + + if(PlayerManager.player_room != null): + PlayerManager.player_room.room_event.on_event_ended() func _stock_shop() -> void: pass - - -func _on_button_pressed() -> void: - PlayerManager.player_room.room_event.on_event_ended() - pass # Replace with function body.