From 75e5f963df6bb05ea0078e303d78a70c2fd94ddd Mon Sep 17 00:00:00 2001 From: Matteo Balugani Date: Mon, 2 Oct 2023 09:35:33 +0200 Subject: [PATCH] absorb sound --- audio/conversione/pop.wav | 3 +++ audio/conversione/pop.wav.import | 24 +++++++++++++++++++ audio/conversione/risucchio.wav | 3 +++ audio/conversione/risucchio.wav.import | 24 +++++++++++++++++++ audio/conversione/suck2.wav | 3 +++ audio/conversione/suck2.wav.import | 24 +++++++++++++++++++ collector/collector.gd | 3 ++- collector/collector.tscn | 11 +++++++-- .../copper_to_silver/copper_converter.tscn | 5 +++- game/game.gd | 1 + game/game.tscn | 9 +++---- 11 files changed, 102 insertions(+), 8 deletions(-) create mode 100644 audio/conversione/pop.wav create mode 100644 audio/conversione/pop.wav.import create mode 100644 audio/conversione/risucchio.wav create mode 100644 audio/conversione/risucchio.wav.import create mode 100644 audio/conversione/suck2.wav create mode 100644 audio/conversione/suck2.wav.import diff --git a/audio/conversione/pop.wav b/audio/conversione/pop.wav new file mode 100644 index 0000000..c19cc7c --- /dev/null +++ b/audio/conversione/pop.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4b45f3fa324f95299db56c189ff255c2a8367044ffb04481f5902fb4ce5ea9bb +size 17706 diff --git a/audio/conversione/pop.wav.import b/audio/conversione/pop.wav.import new file mode 100644 index 0000000..e664cb0 --- /dev/null +++ b/audio/conversione/pop.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://qaptshry5ni0" +path="res://.godot/imported/pop.wav-3ad04e38d234f7a4e0ee733e7ffa6f6d.sample" + +[deps] + +source_file="res://audio/conversione/pop.wav" +dest_files=["res://.godot/imported/pop.wav-3ad04e38d234f7a4e0ee733e7ffa6f6d.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/audio/conversione/risucchio.wav b/audio/conversione/risucchio.wav new file mode 100644 index 0000000..7f9969f --- /dev/null +++ b/audio/conversione/risucchio.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:765d965d7b4a78dc90a3ecc9173260d9eb02a5b26aed11f2b5375f0be1f638c8 +size 18164 diff --git a/audio/conversione/risucchio.wav.import b/audio/conversione/risucchio.wav.import new file mode 100644 index 0000000..52bda06 --- /dev/null +++ b/audio/conversione/risucchio.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cvrbqm56njwoe" +path="res://.godot/imported/risucchio.wav-6351260ea2c52e90831220f184c8f667.sample" + +[deps] + +source_file="res://audio/conversione/risucchio.wav" +dest_files=["res://.godot/imported/risucchio.wav-6351260ea2c52e90831220f184c8f667.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/audio/conversione/suck2.wav b/audio/conversione/suck2.wav new file mode 100644 index 0000000..9dca552 --- /dev/null +++ b/audio/conversione/suck2.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:119106fd6f6c83b978e9d5a885388eb8b7fce7dc0113f68a617470352375bd02 +size 71358 diff --git a/audio/conversione/suck2.wav.import b/audio/conversione/suck2.wav.import new file mode 100644 index 0000000..282f48c --- /dev/null +++ b/audio/conversione/suck2.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://bpxjhl0aq3yrv" +path="res://.godot/imported/suck2.wav-d55db3dd668347ee9fe4634752be5fd1.sample" + +[deps] + +source_file="res://audio/conversione/suck2.wav" +dest_files=["res://.godot/imported/suck2.wav-d55db3dd668347ee9fe4634752be5fd1.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/collector/collector.gd b/collector/collector.gd index 3ccd1dd..d48486f 100644 --- a/collector/collector.gd +++ b/collector/collector.gd @@ -10,7 +10,7 @@ var collected_count: int = 0 ## ## The strings will match only if exactly the same. @export var collecting_types: Array[StringName] - +@export var sound_absorb: AudioStreamPlayer ## The goal amount of entities to collect. ## ## When [collected_count] reaches it, it will be reset to zero, and the "goal" signal will be emitted. @@ -29,6 +29,7 @@ func _on_body_entered(body: Node2D): if collectible and collectible.type in collecting_types: collected_count += 1 collectible.collect() + $sound_absorb.play() emit_signal("collected", body) if collected_count >= collecting_amount: emit_signal("goal") diff --git a/collector/collector.tscn b/collector/collector.tscn index 0273735..a7f738e 100644 --- a/collector/collector.tscn +++ b/collector/collector.tscn @@ -1,8 +1,15 @@ -[gd_scene load_steps=2 format=3 uid="uid://c5w3b55aiui6c"] +[gd_scene load_steps=3 format=3 uid="uid://c5w3b55aiui6c"] [ext_resource type="Script" path="res://collector/collector.gd" id="1_1xtt5"] +[ext_resource type="AudioStream" uid="uid://bpxjhl0aq3yrv" path="res://audio/conversione/suck2.wav" id="2_n0plc"] -[node name="Collector" type="Area2D"] +[node name="Collector" type="Area2D" node_paths=PackedStringArray("sound_absorb")] script = ExtResource("1_1xtt5") +sound_absorb = NodePath("sound_absorb") + +[node name="sound_absorb" type="AudioStreamPlayer" parent="."] +stream = ExtResource("2_n0plc") +volume_db = -8.0 +pitch_scale = 2.0 [connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/converters/copper_to_silver/copper_converter.tscn b/converters/copper_to_silver/copper_converter.tscn index 140553f..3cccf4a 100644 --- a/converters/copper_to_silver/copper_converter.tscn +++ b/converters/copper_to_silver/copper_converter.tscn @@ -59,7 +59,7 @@ size = Vector2(26, 4) size = Vector2(26, 5) [sub_resource type="RectangleShape2D" id="RectangleShape2D_jeo5f"] -size = Vector2(26, 10) +size = Vector2(26, 8.83334) [node name="CopperConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "conversion_timer", "sound_working", "sound_complete", "spawner")] scale = Vector2(3, 3) @@ -124,6 +124,9 @@ debug_color = Color(0.701961, 0, 0, 0.419608) wait_time = 0.5 one_shot = true +[node name="SoundAbsorb" type="AudioStreamPlayer" parent="."] +stream = ExtResource("10_6hhch") + [node name="SoundWorking" type="AudioStreamPlayer" parent="."] stream = ExtResource("10_6hhch") diff --git a/game/game.gd b/game/game.gd index 341697a..3b80e00 100644 --- a/game/game.gd +++ b/game/game.gd @@ -55,6 +55,7 @@ func _on_purchase_success(what: PurchasableItem): store_collector_panel.hide() func _on_store_collector_collected(_body: RigidBody2D): + print("collected") update_counter_text() func update_counter_text(): diff --git a/game/game.tscn b/game/game.tscn index 16deb90..9d6ead0 100644 --- a/game/game.tscn +++ b/game/game.tscn @@ -77,14 +77,15 @@ shape = SubResource("RectangleShape2D_rh35r") debug_color = Color(0, 0.6, 0.701961, 0) [node name="CopperConverter" parent="." instance=ExtResource("7_ipeok")] -position = Vector2(63, 197) - -[node name="CollectShape" parent="CopperConverter/Collector" index="0"] -debug_color = Color(0, 0.701961, 0.188235, 0.419608) +position = Vector2(131, 199) +metadata/_edit_group_ = true [node name="Spawner" parent="CopperConverter" index="6" node_paths=PackedStringArray("target")] target = NodePath("../..") +[node name="PreventSpawnShape" parent="CopperConverter/Spawner" index="0"] +position = Vector2(0, 4.08333) + [node name="SilverConverter" parent="." instance=ExtResource("8_0bbpi")] position = Vector2(205, 337) rotation = -3.14159