From 91cd49e103782523c7551b3ce82afedf47fe314f Mon Sep 17 00:00:00 2001 From: Matteo Balugani Date: Mon, 2 Oct 2023 20:44:53 +0200 Subject: [PATCH] coal_diamond_converter_manca switch --- .../coal_diamond_converter.tscn | 11 ++++++++--- entity/coal_diamond/diamond.tscn | 1 + entity/coin_copper/coin_copper.tscn | 3 +++ entity/coin_gold/coin_gold.tscn | 2 +- game/game.gd | 5 ----- game/game.tscn | 18 ++++++++++++++---- main.gd | 3 --- 7 files changed, 27 insertions(+), 16 deletions(-) diff --git a/converters/gold_to_coaldiamond/coal_diamond_converter.tscn b/converters/gold_to_coaldiamond/coal_diamond_converter.tscn index 179196c..899be96 100644 --- a/converters/gold_to_coaldiamond/coal_diamond_converter.tscn +++ b/converters/gold_to_coaldiamond/coal_diamond_converter.tscn @@ -9,8 +9,8 @@ [ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="7_rxm8j"] [ext_resource type="Texture2D" uid="uid://b3vbqgitwo8la" path="res://converters/gold_to_coaldiamond/diamond_converter_front_5.png" id="7_swl1g"] [ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="8_yel0k"] -[ext_resource type="PackedScene" uid="uid://dme22vvfgme5f" path="res://entity/coin_silver/coin_silver.tscn" id="9_nosjr"] [ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="10_hy4ck"] +[ext_resource type="PackedScene" uid="uid://diy8fj7mcc00p" path="res://entity/coal_diamond/coal.tscn" id="10_ry7ak"] [ext_resource type="AudioStream" uid="uid://7tw5efuo3gxj" path="res://audio/conversione/coin_to_coin.wav" id="11_5c46k"] [ext_resource type="PackedScene" uid="uid://bevj27e1ha8m3" path="res://converters/converter_placement_body.tscn" id="12_xld3l"] @@ -70,11 +70,16 @@ size = Vector2(26, 5) [sub_resource type="RectangleShape2D" id="RectangleShape2D_jeo5f"] size = Vector2(26, 10) -[node name="CoalDiamondConverter" type="StaticBody2D"] +[node name="CoalDiamondConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "conversion_timer", "sound_working", "sound_complete", "spawner")] scale = Vector2(3, 3) collision_layer = 8 collision_mask = 0 script = ExtResource("1_mf1ls") +sprite_front = NodePath("SpriteFront") +conversion_timer = NodePath("ConversionTimer") +sound_working = NodePath("SoundWorking") +sound_complete = NodePath("SoundComplete") +spawner = NodePath("Spawner") [node name="SpriteBack" type="Sprite2D" parent="."] z_index = -2 @@ -114,7 +119,7 @@ debug_color = Color(0, 0.701961, 0.188235, 0.419608) [node name="Spawner" parent="." instance=ExtResource("8_yel0k")] position = Vector2(0, 8) -scene = ExtResource("9_nosjr") +scene = ExtResource("10_ry7ak") buffer_cap = 1 spawn_rect = Rect2(-8, 0, 16, 4) spawn_rotation_degrees_min = 80.0 diff --git a/entity/coal_diamond/diamond.tscn b/entity/coal_diamond/diamond.tscn index b43ea0e..764598d 100644 --- a/entity/coal_diamond/diamond.tscn +++ b/entity/coal_diamond/diamond.tscn @@ -31,5 +31,6 @@ texture = ExtResource("2_abwth") type = &"Diamond" [node name="Valuable" parent="." instance=ExtResource("4_yfos5")] +value = 1000 [connection signal="collected" from="Collectible" to="Collectible" method="_on_done" flags=18] diff --git a/entity/coin_copper/coin_copper.tscn b/entity/coin_copper/coin_copper.tscn index 6546a5b..9297f4b 100644 --- a/entity/coin_copper/coin_copper.tscn +++ b/entity/coin_copper/coin_copper.tscn @@ -49,4 +49,7 @@ volume_db = -24.397 wait_time = 2.108 one_shot = true +[connection signal="body_entered" from="." to="." method="_on_body_entered"] +[connection signal="body_exited" from="." to="." method="_on_body_exited"] +[connection signal="sleeping_state_changed" from="." to="." method="_on_sleeping_state_changed"] [connection signal="collected" from="Collectible" to="Collectible" method="_on_done"] diff --git a/entity/coin_gold/coin_gold.tscn b/entity/coin_gold/coin_gold.tscn index 2057d7f..011a7ee 100644 --- a/entity/coin_gold/coin_gold.tscn +++ b/entity/coin_gold/coin_gold.tscn @@ -7,7 +7,7 @@ [ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="5_palpv"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_c6byl"] -size = Vector2(27, 5) +size = Vector2(20, 16) [node name="CoinGold" type="RigidBody2D"] collision_layer = 4 diff --git a/game/game.gd b/game/game.gd index 4824f19..6800cf5 100644 --- a/game/game.gd +++ b/game/game.gd @@ -71,7 +71,6 @@ func update_counter_text(): @export var upgrade_copper_texture: Texture2D @export var upgrade_silver_texture: Texture2D @export var upgrade_gold_texture: Texture2D -@export var upgrade_gem_texture: Texture2D func update_counter_icon(): if len(store_collector.collecting_types) == 0: @@ -82,8 +81,6 @@ func update_counter_icon(): store_collector_texturerect.texture = upgrade_silver_texture elif store_collector.collecting_types[0] == &"Gold": store_collector_texturerect.texture = upgrade_gold_texture - elif store_collector.collecting_types[0] == &"Gem": - store_collector_texturerect.texture = upgrade_gem_texture else: store_collector_texturerect.texture = null @@ -95,8 +92,6 @@ func _on_ghost_requested(scene: PackedScene, texture: Texture2D): func _on_ghost_materialize(): var instantiated = ghost.materialize() - if not instantiated: - return #TODO FIXME var spawner = instantiated.find_child("Spawner") if spawner != null: spawner.target = self diff --git a/game/game.tscn b/game/game.tscn index 24e122d..390eaae 100644 --- a/game/game.tscn +++ b/game/game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=24 format=3 uid="uid://c3rxmcwa5nqng"] +[gd_scene load_steps=25 format=3 uid="uid://c3rxmcwa5nqng"] [ext_resource type="Script" path="res://game/game.gd" id="1_i3ly0"] [ext_resource type="PackedScene" uid="uid://bllsprv8orpn4" path="res://bottle/bottle.tscn" id="1_y7o2l"] @@ -6,7 +6,6 @@ [ext_resource type="Texture2D" uid="uid://7b12rwclhrq0" path="res://interface/upgrade_silver.png" id="3_8wvr1"] [ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="3_qwsty"] [ext_resource type="Texture2D" uid="uid://taojrwr7xrp4" path="res://interface/upgrade_gold.png" id="4_i557v"] -[ext_resource type="Texture2D" uid="uid://yx3gme4q4ote" path="res://interface/upgrade_gem.png" id="5_wbw72"] [ext_resource type="Texture2D" uid="uid://pj3ip6vlatms" path="res://converters/copper_to_silver/copper_converter.png" id="6_0jj8g"] [ext_resource type="PackedScene" uid="uid://beg758fa6o0cs" path="res://value/evaluator.tscn" id="6_my6nv"] [ext_resource type="PackedScene" uid="uid://ratkps4plkhl" path="res://converters/copper_to_silver/copper_converter.tscn" id="7_ipeok"] @@ -17,7 +16,9 @@ [ext_resource type="Texture2D" uid="uid://c8pvjgtr2ufjl" path="res://interface/upgrade_copper.png" id="11_lt33g"] [ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper/coin_copper.tscn" id="13_4j8om"] [ext_resource type="Script" path="res://game/DebugTimer.gd" id="13_6ai3c"] +[ext_resource type="PackedScene" uid="uid://du3005kwybbrh" path="res://entity/coin_gold/coin_gold.tscn" id="13_8ux81"] [ext_resource type="PackedScene" uid="uid://qtk4tm6l367w" path="res://interface/ghost.tscn" id="16_8vhx6"] +[ext_resource type="PackedScene" uid="uid://clanhkk4sg47w" path="res://converters/gold_to_coaldiamond/coal_diamond_converter.tscn" id="18_bjs6i"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_rh35r"] size = Vector2(240, 384) @@ -40,7 +41,6 @@ script = ExtResource("1_i3ly0") upgrade_copper_texture = ExtResource("11_lt33g") upgrade_silver_texture = ExtResource("3_8wvr1") upgrade_gold_texture = ExtResource("4_i557v") -upgrade_gem_texture = ExtResource("5_wbw72") [node name="GravityFromGyro" parent="." instance=ExtResource("2_h2pfr")] @@ -66,6 +66,7 @@ debug_color = Color(0, 0.6, 0.701961, 0) [node name="TimeSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")] position = Vector2(136, 0) +scene = ExtResource("13_8ux81") target = NodePath("..") buffer_cap = 1 spawn_rect = Rect2(-20, 0, 40, 0) @@ -77,6 +78,7 @@ shape = SubResource("RectangleShape2D_4uksi") debug_color = Color(0, 0.6, 0.701961, 0) [node name="Timer" type="Timer" parent="TimeSpawner"] +one_shot = true [node name="DebugSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")] position = Vector2(136, 0) @@ -84,7 +86,7 @@ scene = ExtResource("13_4j8om") target = NodePath("..") buffer_cap = 1 spawn_rect = Rect2(-20, 0, 40, 0) -overlapping_body_count_limit = 16 +overlapping_body_count_limit = 128 metadata/_edit_lock_ = true [node name="NeckShape" type="CollisionShape2D" parent="DebugSpawner"] @@ -187,7 +189,15 @@ position = Vector2(405, 540) shape = SubResource("RectangleShape2D_jed57") debug_color = Color(0, 0, 0, 0.419608) +[node name="CoalDiamondConverter" parent="." instance=ExtResource("18_bjs6i")] +position = Vector2(140, 217) + +[node name="Spawner" parent="CoalDiamondConverter" index="6" node_paths=PackedStringArray("target")] +target = NodePath("../..") + [connection signal="changed" from="Bottle/Evaluator" to="." method="_on_score_changed"] [connection signal="timeout" from="TimeSpawner/Timer" to="TimeSpawner" method="spawn"] [connection signal="timeout" from="DebugSpawner/DebugTimer" to="DebugSpawner" method="spawn"] [connection signal="collected" from="StoreCollector" to="." method="_on_store_collector_collected"] + +[editable path="CoalDiamondConverter"] diff --git a/main.gd b/main.gd index 76eb5ce..21296a8 100644 --- a/main.gd +++ b/main.gd @@ -54,6 +54,3 @@ func _on_shop_ui_delete_begin(): func _on_shop_ui_delete_cancel(): ui_state = UIState.GAME - -func _on_shop_ui_purchase_cancel(_what): - ui_state = UIState.GAME