diff --git a/converters/gold_to_coaldiamond/coal_diamond_converter.tscn b/converters/gold_to_coaldiamond/coal_diamond_converter.tscn index 6320110..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,12 +70,16 @@ size = Vector2(26, 5) [sub_resource type="RectangleShape2D" id="RectangleShape2D_jeo5f"] size = Vector2(26, 10) -[node name="CoalDiamondConverter" type="StaticBody2D" node_paths=PackedStringArray("spawner")] +[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") -spawner = NodePath("") +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 @@ -115,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/coal.tscn b/entity/coal_diamond/coal.tscn new file mode 100644 index 0000000..0caf55c --- /dev/null +++ b/entity/coal_diamond/coal.tscn @@ -0,0 +1,35 @@ +[gd_scene load_steps=6 format=3 uid="uid://diy8fj7mcc00p"] + +[ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="1_ftt7x"] +[ext_resource type="Texture2D" uid="uid://bgq5afrrpc4a3" path="res://entity/coal_diamond/diamond_white.png" id="2_ug7o0"] +[ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="4_e8hbs"] +[ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="5_3e4d8"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_x6m8s"] +radius = 10.5119 + +[node name="Coal" type="RigidBody2D"] +collision_layer = 4 +collision_mask = 14 +mass = 2.0 +inertia = 600.0 +physics_material_override = ExtResource("1_ftt7x") +continuous_cd = 1 +can_sleep = false +linear_damp = 0.1 +angular_damp = 0.1 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +scale = Vector2(2, 2) +shape = SubResource("CircleShape2D_x6m8s") + +[node name="Sprite" type="Sprite2D" parent="CollisionShape2D"] +texture_filter = 1 +texture = ExtResource("2_ug7o0") + +[node name="Collectible" parent="." instance=ExtResource("4_e8hbs")] +type = &"Coal" + +[node name="Valuable" parent="." instance=ExtResource("5_3e4d8")] + +[connection signal="collected" from="Collectible" to="Collectible" method="_on_done" flags=18] diff --git a/entity/gem/diamond.png b/entity/coal_diamond/diamond.png similarity index 100% rename from entity/gem/diamond.png rename to entity/coal_diamond/diamond.png diff --git a/entity/gem/diamond.png.import b/entity/coal_diamond/diamond.png.import similarity index 71% rename from entity/gem/diamond.png.import rename to entity/coal_diamond/diamond.png.import index 8abbbb8..ea59bdd 100644 --- a/entity/gem/diamond.png.import +++ b/entity/coal_diamond/diamond.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://bquk2q5g6bst5" -path="res://.godot/imported/diamond.png-0575d649be1d35db3ad92a77f7f138c4.ctex" +path="res://.godot/imported/diamond.png-0fb18f4a52a588670257dc6a7f72ec4b.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/gem/diamond.png" -dest_files=["res://.godot/imported/diamond.png-0575d649be1d35db3ad92a77f7f138c4.ctex"] +source_file="res://entity/coal_diamond/diamond.png" +dest_files=["res://.godot/imported/diamond.png-0fb18f4a52a588670257dc6a7f72ec4b.ctex"] [params] diff --git a/entity/coal_diamond/diamond.tscn b/entity/coal_diamond/diamond.tscn new file mode 100644 index 0000000..764598d --- /dev/null +++ b/entity/coal_diamond/diamond.tscn @@ -0,0 +1,36 @@ +[gd_scene load_steps=6 format=3 uid="uid://cr5tiep20hk0s"] + +[ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="1_mma75"] +[ext_resource type="Texture2D" uid="uid://bquk2q5g6bst5" path="res://entity/coal_diamond/diamond.png" id="2_abwth"] +[ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="3_n4fa5"] +[ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="4_yfos5"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_x6m8s"] +radius = 10.5119 + +[node name="Diamond" type="RigidBody2D"] +collision_layer = 4 +collision_mask = 14 +mass = 2.0 +inertia = 600.0 +physics_material_override = ExtResource("1_mma75") +continuous_cd = 1 +can_sleep = false +linear_damp = 0.1 +angular_damp = 0.1 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +scale = Vector2(2, 2) +shape = SubResource("CircleShape2D_x6m8s") + +[node name="Sprite" type="Sprite2D" parent="CollisionShape2D"] +texture_filter = 1 +texture = ExtResource("2_abwth") + +[node name="Collectible" parent="." instance=ExtResource("3_n4fa5")] +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/gem/diamond_white.png b/entity/coal_diamond/diamond_white.png similarity index 100% rename from entity/gem/diamond_white.png rename to entity/coal_diamond/diamond_white.png diff --git a/entity/gem/diamond_white.png.import b/entity/coal_diamond/diamond_white.png.import similarity index 70% rename from entity/gem/diamond_white.png.import rename to entity/coal_diamond/diamond_white.png.import index 937ac9d..2c14cda 100644 --- a/entity/gem/diamond_white.png.import +++ b/entity/coal_diamond/diamond_white.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://bgq5afrrpc4a3" -path="res://.godot/imported/diamond_white.png-ea17eba66708a2de5eae13c889056729.ctex" +path="res://.godot/imported/diamond_white.png-3d313595ab6d3b2376dafee829b7e427.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/gem/diamond_white.png" -dest_files=["res://.godot/imported/diamond_white.png-ea17eba66708a2de5eae13c889056729.ctex"] +source_file="res://entity/coal_diamond/diamond_white.png" +dest_files=["res://.godot/imported/diamond_white.png-3d313595ab6d3b2376dafee829b7e427.ctex"] [params] diff --git a/entity/coin_copper/coin_copper.tscn b/entity/coin_copper/coin_copper.tscn index abd0c90..9297f4b 100644 --- a/entity/coin_copper/coin_copper.tscn +++ b/entity/coin_copper/coin_copper.tscn @@ -5,7 +5,7 @@ [ext_resource type="Texture2D" uid="uid://2vtvoj6ua3cb" path="res://entity/coin_copper/coin_copper_outline_2.png" id="3_dq1f7"] [ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="4_npwn2"] [ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="5_fd0r7"] -[ext_resource type="AudioStream" uid="uid://ds2rl6eg5jr1" path="res://audio/tap/click5.wav" id="7_fxd28"] +[ext_resource type="AudioStream" uid="uid://wy7f2j0wg1ur" path="res://audio/tap/click5.wav" id="7_fxd28"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_c6byl"] size = Vector2(14, 3) @@ -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 diff --git a/main.tscn b/main.tscn index ee10b53..b04b443 100644 --- a/main.tscn +++ b/main.tscn @@ -6,7 +6,7 @@ [ext_resource type="PackedScene" uid="uid://cklkdygv61bny" path="res://interface/shop_ui.tscn" id="2_qj86l"] [ext_resource type="Script" path="res://interface/custom_ui.gd" id="3_xav0n"] [ext_resource type="PackedScene" uid="uid://bo5unrhqpoyim" path="res://interface/game_ui.tscn" id="4_siim3"] -[ext_resource type="PackedScene" uid="uid://bpvx3nkkbluip" path="res://safe_ui.tscn" id="5_2uxda"] +[ext_resource type="PackedScene" path="res://safe_ui.tscn" id="5_2uxda"] [ext_resource type="Script" path="res://game_camera.gd" id="5_xxjtg"] [sub_resource type="GDScript" id="GDScript_kyj65"]