diff --git a/entity/gem_stack.png.import b/entity/gem_stack.png.import new file mode 100644 index 0000000..d5a934d --- /dev/null +++ b/entity/gem_stack.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d22mg4nls6ju8" +path="res://.godot/imported/gem_stack.png-48697e8b235aeec145f6f7d9b3d945cf.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://entity/gem_stack.png" +dest_files=["res://.godot/imported/gem_stack.png-48697e8b235aeec145f6f7d9b3d945cf.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/game/game.gd b/game/game.gd index d2fc53d..423e2db 100644 --- a/game/game.gd +++ b/game/game.gd @@ -91,4 +91,7 @@ func _on_ghost_requested(scene: PackedScene, texture: Texture2D): ghost.show() func _on_ghost_materialize(): - ghost.materialize() + var instantiated = ghost.materialize() + var spawner = instantiated.find_child("Spawner") + if spawner != null: + spawner.target = self diff --git a/game/game.tscn b/game/game.tscn index 4c746f2..227b867 100644 --- a/game/game.tscn +++ b/game/game.tscn @@ -21,7 +21,7 @@ size = Vector2(240, 384) [sub_resource type="RectangleShape2D" id="RectangleShape2D_4uksi"] -size = Vector2(80, 80) +size = Vector2(80, 160) [sub_resource type="RectangleShape2D" id="RectangleShape2D_i50bq"] size = Vector2(540, 135) @@ -44,11 +44,10 @@ upgrade_gold_texture = ExtResource("4_i557v") [node name="Ghost" parent="." node_paths=PackedStringArray("target") instance=ExtResource("16_8vhx6")] process_mode = 4 visible = false -position = Vector2(135, 360) +position = Vector2(253, 109) preview_texture = ExtResource("6_0jj8g") scene_to_instantiate = ExtResource("7_ipeok") target = NodePath("..") -metadata/_edit_lock_ = true [node name="Bottle" parent="." instance=ExtResource("1_y7o2l")] metadata/_edit_lock_ = true @@ -71,7 +70,6 @@ overlapping_body_count_limit = 4 metadata/_edit_lock_ = true [node name="NeckShape" type="CollisionShape2D" parent="TimeSpawner"] -position = Vector2(0, 40) shape = SubResource("RectangleShape2D_4uksi") debug_color = Color(0, 0.6, 0.701961, 0) @@ -87,7 +85,6 @@ overlapping_body_count_limit = 4 metadata/_edit_lock_ = true [node name="NeckShape" type="CollisionShape2D" parent="ButtonSpawner"] -position = Vector2(0, 40) shape = SubResource("RectangleShape2D_4uksi") debug_color = Color(0, 0.6, 0.701961, 0) diff --git a/interface/game_ui.gd b/interface/game_ui.gd index b794ecf..c3db18c 100644 --- a/interface/game_ui.gd +++ b/interface/game_ui.gd @@ -1,7 +1,8 @@ extends Control class_name GameUI -@export var score_button: ScoreButton +@onready var score_button: ScoreButton = $ScoreButton +@onready var spawn_button: Button = $SpawnButton ## Emitted when the Score button is pressed. signal score_button_pressed @@ -24,3 +25,16 @@ func _on_shop_button_pressed(): func _on_game_score_changed(total: int): score_button.set_score(total) + + +func _on_shop_ui_purchase_begin(_what: PurchasableItem): + spawn_button.disabled = true + spawn_button.text = "Pay" + +func _on_shop_ui_purchase_cancel(_what: PurchasableItem): + spawn_button.disabled = false + spawn_button.text = "Put" + +func _on_shop_ui_purchase_success(_what: PurchasableItem): + spawn_button.disabled = false + spawn_button.text = "Put" diff --git a/interface/game_ui.tscn b/interface/game_ui.tscn index 8eef1bf..ffc5389 100644 --- a/interface/game_ui.tscn +++ b/interface/game_ui.tscn @@ -4,7 +4,7 @@ [ext_resource type="Script" path="res://interface/game_ui.gd" id="2_33nqa"] [ext_resource type="PackedScene" uid="uid://bey5lilvteg32" path="res://interface/score_button.tscn" id="3_vobar"] -[node name="GameUI" type="Control" node_paths=PackedStringArray("score_button")] +[node name="GameUI" type="Control"] custom_minimum_size = Vector2(0, 54) layout_mode = 3 anchors_preset = 10 @@ -12,7 +12,6 @@ anchor_right = 1.0 grow_horizontal = 2 theme = ExtResource("1_ppf8y") script = ExtResource("2_33nqa") -score_button = NodePath("ScoreButton") [node name="ScoreButton" parent="." instance=ExtResource("3_vobar")] custom_minimum_size = Vector2(88, 0) @@ -29,7 +28,7 @@ offset_right = 36.0 offset_bottom = 54.0 grow_horizontal = 2 size_flags_horizontal = 4 -text = "Drop" +text = "Put" [node name="ShopButton" type="Button" parent="."] custom_minimum_size = Vector2(88, 0) diff --git a/interface/ghost.gd b/interface/ghost.gd index d338bdc..8d26a47 100644 --- a/interface/ghost.gd +++ b/interface/ghost.gd @@ -105,3 +105,4 @@ func materialize(): instantiated.rotation = rotation target.add_child(instantiated) materialized.emit(instantiated) + return instantiated diff --git a/interface/shop_ui.tscn b/interface/shop_ui.tscn index b1efc34..a52768f 100644 --- a/interface/shop_ui.tscn +++ b/interface/shop_ui.tscn @@ -121,10 +121,10 @@ layout_mode = 2 item_icon = ExtResource("5_lu2tr") item_name = "Silver-ifier" item_description = "Exchanges ten copper coins for a shiny silver coin!" -item_cost_text = "35 copper" +item_cost_text = "100 copper" item_scene = ExtResource("10_dui5v") item_cost_type = &"Copper" -item_cost_goal = 35 +item_cost_goal = 100 [node name="PurchasableItemPadding" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("3_4feaj")] layout_mode = 2 @@ -134,8 +134,10 @@ layout_mode = 2 item_icon = ExtResource("6_70u64") item_name = "Gold-enser" item_description = "Trades in ten silver coins for a sparkly gold coin!" -item_cost_text = "??" +item_cost_text = "40 silver" item_scene = ExtResource("12_ml4jm") +item_cost_type = &"Silver" +item_cost_goal = 40 has_unlocked = false [node name="PurchasableItemPadding2" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("3_4feaj")] @@ -146,8 +148,10 @@ layout_mode = 2 item_icon = ExtResource("13_gsd84") item_name = "Gem-ificator" item_description = "Converts ten gold coins into a randomly colored gem!" -item_cost_text = "??" +item_cost_text = "20 gold" item_scene = ExtResource("13_m0kio") +item_cost_type = &"Gold" +item_cost_goal = 20 has_unlocked = false [node name="PurchasableItemPadding4" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("3_4feaj")] @@ -171,6 +175,8 @@ item_name = "Arti-factory" item_description = "Assembles an artifact from twenty-five gold coins and a gem or a diamond!" item_cost_text = "??" item_scene = ExtResource("14_tgckt") +item_cost_type = &"Gem" +item_cost_goal = 20 has_unlocked = false [node name="PurchasableItemPadding7" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("3_4feaj")] @@ -199,9 +205,9 @@ layout_mode = 2 item_icon = ExtResource("8_270dw") item_name = "Auto-copper" item_description = "Receive two copper coins per second!" -item_cost_text = "50 copper" +item_cost_text = "40 copper" item_cost_type = &"Copper" -item_cost_goal = 50 +item_cost_goal = 40 one_shot = true [node name="PurchasableItemPadding" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory" instance=ExtResource("3_4feaj")] @@ -212,9 +218,9 @@ layout_mode = 2 item_icon = ExtResource("8_270dw") item_name = "Heli-copper" item_description = "Receive eight copper coins per second!" -item_cost_text = "8 silver" -item_cost_type = &"Silver" -item_cost_goal = 8 +item_cost_text = "160 copper" +item_cost_type = &"Copper" +item_cost_goal = 160 has_unlocked = false one_shot = true @@ -226,7 +232,9 @@ layout_mode = 2 item_icon = ExtResource("8_caq4i") item_name = "Auto-silver" item_description = "Receive two silver coins per second!" -item_cost_text = "??" +item_cost_text = "40 silver" +item_cost_type = &"Silver" +item_cost_goal = 40 has_unlocked = false one_shot = true @@ -236,9 +244,11 @@ layout_mode = 2 [node name="BuySuperSilver" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory" instance=ExtResource("2_2dtc0")] layout_mode = 2 item_icon = ExtResource("8_caq4i") -item_name = "Super silver" +item_name = "Super-silver" item_description = "Receive eight silver coins per second!" -item_cost_text = "??" +item_cost_text = "5 gold" +item_cost_type = &"Gold" +item_cost_goal = 5 has_unlocked = false one_shot = true @@ -250,7 +260,9 @@ layout_mode = 2 item_icon = ExtResource("9_amnej") item_name = "Auto-gold" item_description = "Receive two gold coins per second!" -item_cost_text = "??" +item_cost_text = "15 gems" +item_cost_type = &"Gem" +item_cost_goal = 15 has_unlocked = false one_shot = true @@ -260,9 +272,11 @@ layout_mode = 2 [node name="BuyMidasTouch" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory" instance=ExtResource("2_2dtc0")] layout_mode = 2 item_icon = ExtResource("9_amnej") -item_name = "Midas Touch" +item_name = "Tera-gold" item_description = "Receive eight gold coins per second!" -item_cost_text = "??" +item_cost_text = "5 gems" +item_cost_type = &"Gem" +item_cost_goal = 5 has_unlocked = false one_shot = true @@ -290,7 +304,7 @@ layout_mode = 2 [node name="BuySilverStar" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/AutomaticCategory" instance=ExtResource("2_2dtc0")] layout_mode = 2 item_icon = ExtResource("8_caq4i") -item_name = "Silver star" +item_name = "Quick silver" item_description = "Create a silver coin when tapping!" item_cost_text = "??" has_unlocked = false @@ -302,7 +316,7 @@ layout_mode = 2 [node name="BuyGoldStar" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/AutomaticCategory" instance=ExtResource("2_2dtc0")] layout_mode = 2 item_icon = ExtResource("9_amnej") -item_name = "Gold star" +item_name = "Midas Touch" item_description = "Create a gold coin when tapping!" item_cost_text = "??" has_unlocked = false diff --git a/main.tscn b/main.tscn index 214fc37..9619093 100644 --- a/main.tscn +++ b/main.tscn @@ -87,8 +87,11 @@ layout_mode = 2 [connection signal="ghost_requested" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_ghost_requested"] [connection signal="purchase_begin" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_purchase_begin"] [connection signal="purchase_begin" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_purchase_begin"] +[connection signal="purchase_begin" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameSafeUI/GameUI" method="_on_shop_ui_purchase_begin"] [connection signal="purchase_cancel" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_purchase_cancel"] +[connection signal="purchase_cancel" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameSafeUI/GameUI" method="_on_shop_ui_purchase_cancel"] [connection signal="purchase_success" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_purchase_success"] +[connection signal="purchase_success" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameSafeUI/GameUI" method="_on_shop_ui_purchase_success"] [connection signal="score_button_pressed" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_score_button_pressed"] [connection signal="upgraded_auto_spawn" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_upgraded_auto_spawn"] [connection signal="upgraded_manual_spawn" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_upgraded_manual_spawn"]