1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-21 23:34:18 +00:00

absorb sound

This commit is contained in:
Matteo Balugani 2023-10-02 09:35:33 +02:00
parent af63dff132
commit 75e5f963df
11 changed files with 102 additions and 8 deletions

BIN
audio/conversione/pop.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -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

BIN
audio/conversione/risucchio.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -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

BIN
audio/conversione/suck2.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -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

View file

@ -10,7 +10,7 @@ var collected_count: int = 0
## ##
## The strings will match only if exactly the same. ## The strings will match only if exactly the same.
@export var collecting_types: Array[StringName] @export var collecting_types: Array[StringName]
@export var sound_absorb: AudioStreamPlayer
## The goal amount of entities to collect. ## 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. ## 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: if collectible and collectible.type in collecting_types:
collected_count += 1 collected_count += 1
collectible.collect() collectible.collect()
$sound_absorb.play()
emit_signal("collected", body) emit_signal("collected", body)
if collected_count >= collecting_amount: if collected_count >= collecting_amount:
emit_signal("goal") emit_signal("goal")

View file

@ -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="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") 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"] [connection signal="body_entered" from="." to="." method="_on_body_entered"]

View file

@ -59,7 +59,7 @@ size = Vector2(26, 4)
size = Vector2(26, 5) size = Vector2(26, 5)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_jeo5f"] [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")] [node name="CopperConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "conversion_timer", "sound_working", "sound_complete", "spawner")]
scale = Vector2(3, 3) scale = Vector2(3, 3)
@ -124,6 +124,9 @@ debug_color = Color(0.701961, 0, 0, 0.419608)
wait_time = 0.5 wait_time = 0.5
one_shot = true one_shot = true
[node name="SoundAbsorb" type="AudioStreamPlayer" parent="."]
stream = ExtResource("10_6hhch")
[node name="SoundWorking" type="AudioStreamPlayer" parent="."] [node name="SoundWorking" type="AudioStreamPlayer" parent="."]
stream = ExtResource("10_6hhch") stream = ExtResource("10_6hhch")

View file

@ -55,6 +55,7 @@ func _on_purchase_success(what: PurchasableItem):
store_collector_panel.hide() store_collector_panel.hide()
func _on_store_collector_collected(_body: RigidBody2D): func _on_store_collector_collected(_body: RigidBody2D):
print("collected")
update_counter_text() update_counter_text()
func update_counter_text(): func update_counter_text():

View file

@ -77,14 +77,15 @@ shape = SubResource("RectangleShape2D_rh35r")
debug_color = Color(0, 0.6, 0.701961, 0) debug_color = Color(0, 0.6, 0.701961, 0)
[node name="CopperConverter" parent="." instance=ExtResource("7_ipeok")] [node name="CopperConverter" parent="." instance=ExtResource("7_ipeok")]
position = Vector2(63, 197) position = Vector2(131, 199)
metadata/_edit_group_ = true
[node name="CollectShape" parent="CopperConverter/Collector" index="0"]
debug_color = Color(0, 0.701961, 0.188235, 0.419608)
[node name="Spawner" parent="CopperConverter" index="6" node_paths=PackedStringArray("target")] [node name="Spawner" parent="CopperConverter" index="6" node_paths=PackedStringArray("target")]
target = NodePath("../..") target = NodePath("../..")
[node name="PreventSpawnShape" parent="CopperConverter/Spawner" index="0"]
position = Vector2(0, 4.08333)
[node name="SilverConverter" parent="." instance=ExtResource("8_0bbpi")] [node name="SilverConverter" parent="." instance=ExtResource("8_0bbpi")]
position = Vector2(205, 337) position = Vector2(205, 337)
rotation = -3.14159 rotation = -3.14159