From 65c3ec32bc671c1414b62a5d598ee2253145ae74 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 2 Oct 2023 19:49:55 +0200 Subject: [PATCH 1/3] Tweaks --- entity/gem_stack.png.import | 34 ++++++++++++++++++++++++++ game/game.gd | 5 +++- game/game.tscn | 7 ++---- interface/game_ui.gd | 16 ++++++++++++- interface/game_ui.tscn | 5 ++-- interface/ghost.gd | 1 + interface/shop_ui.tscn | 48 ++++++++++++++++++++++++------------- main.tscn | 3 +++ 8 files changed, 92 insertions(+), 27 deletions(-) create mode 100644 entity/gem_stack.png.import 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"] From 3743a715868354fa4d1fe512e29009329738186d Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 2 Oct 2023 19:50:56 +0200 Subject: [PATCH 2/3] caffeinate entities --- entity/coin_copper/coin_copper.tscn | 1 + entity/coin_gold/coin_gold.tscn | 1 + entity/coin_silver/coin_silver.tscn | 1 + entity/gem/gem.tscn | 1 + 4 files changed, 4 insertions(+) diff --git a/entity/coin_copper/coin_copper.tscn b/entity/coin_copper/coin_copper.tscn index 99d56e2..7588034 100644 --- a/entity/coin_copper/coin_copper.tscn +++ b/entity/coin_copper/coin_copper.tscn @@ -18,6 +18,7 @@ physics_material_override = ExtResource("1_1fypc") continuous_cd = 1 max_contacts_reported = 1 contact_monitor = true +can_sleep = false linear_damp = 0.1 angular_damp = 0.1 diff --git a/entity/coin_gold/coin_gold.tscn b/entity/coin_gold/coin_gold.tscn index bece8eb..2057d7f 100644 --- a/entity/coin_gold/coin_gold.tscn +++ b/entity/coin_gold/coin_gold.tscn @@ -16,6 +16,7 @@ mass = 2.0 inertia = 600.0 physics_material_override = ExtResource("1_nfq5t") continuous_cd = 1 +can_sleep = false linear_damp = 0.1 angular_damp = 0.1 diff --git a/entity/coin_silver/coin_silver.tscn b/entity/coin_silver/coin_silver.tscn index 2555361..8715912 100644 --- a/entity/coin_silver/coin_silver.tscn +++ b/entity/coin_silver/coin_silver.tscn @@ -17,6 +17,7 @@ mass = 1.5 inertia = 800.0 physics_material_override = ExtResource("1_4sq1a") continuous_cd = 1 +can_sleep = false linear_damp = 0.1 angular_damp = 0.1 diff --git a/entity/gem/gem.tscn b/entity/gem/gem.tscn index 08cd7e6..744004e 100644 --- a/entity/gem/gem.tscn +++ b/entity/gem/gem.tscn @@ -20,6 +20,7 @@ mass = 1.5 inertia = 800.0 physics_material_override = ExtResource("1_vmemd") continuous_cd = 1 +can_sleep = false linear_damp = 0.1 angular_damp = 0.1 From cd0ddc0f5ab839d30b566de67f399d074700e964 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 2 Oct 2023 19:52:20 +0200 Subject: [PATCH 3/3] Make converter pickable and scale --- converters/copper_to_silver/copper_converter.tscn | 1 + converters/gold_to_gem/gold_converter.tscn | 2 ++ converters/item_converter/item_converter.tscn | 1 + converters/silver_to_gold/silver_converter.tscn | 1 + 4 files changed, 5 insertions(+) diff --git a/converters/copper_to_silver/copper_converter.tscn b/converters/copper_to_silver/copper_converter.tscn index db203d4..a41706e 100644 --- a/converters/copper_to_silver/copper_converter.tscn +++ b/converters/copper_to_silver/copper_converter.tscn @@ -66,6 +66,7 @@ size = Vector2(26, 10) scale = Vector2(3, 3) collision_layer = 8 collision_mask = 0 +input_pickable = true script = ExtResource("1_mas6k") sprite_front = NodePath("SpriteFront") conversion_timer = NodePath("ConversionTimer") diff --git a/converters/gold_to_gem/gold_converter.tscn b/converters/gold_to_gem/gold_converter.tscn index 6ebc3e4..c84adde 100644 --- a/converters/gold_to_gem/gold_converter.tscn +++ b/converters/gold_to_gem/gold_converter.tscn @@ -71,8 +71,10 @@ size = Vector2(26, 5) size = Vector2(26, 8.83334) [node name="GoldConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "conversion_timer", "sound_working", "sound_complete", "spawner")] +scale = Vector2(3, 3) collision_layer = 8 collision_mask = 0 +input_pickable = true script = ExtResource("1_fgju3") sprite_front = NodePath("SpriteFront") conversion_timer = NodePath("ConversionTimer") diff --git a/converters/item_converter/item_converter.tscn b/converters/item_converter/item_converter.tscn index 943986e..238b9bf 100644 --- a/converters/item_converter/item_converter.tscn +++ b/converters/item_converter/item_converter.tscn @@ -146,6 +146,7 @@ size = Vector2(26, 8.83334) scale = Vector2(3, 3) collision_layer = 8 collision_mask = 0 +input_pickable = true script = ExtResource("1_qln0a") sprite_front = NodePath("SpriteFront") sprite_back = NodePath("SpriteBack") diff --git a/converters/silver_to_gold/silver_converter.tscn b/converters/silver_to_gold/silver_converter.tscn index 8d7d64d..d33faea 100644 --- a/converters/silver_to_gold/silver_converter.tscn +++ b/converters/silver_to_gold/silver_converter.tscn @@ -50,6 +50,7 @@ size = Vector2(26, 10) scale = Vector2(3, 3) collision_layer = 8 collision_mask = 0 +input_pickable = true script = ExtResource("1_chhfg") sprite_front = NodePath("SpriteFront") conversion_timer = NodePath("ConversionTimer")