diff --git a/src/player/grunk_collection_sfx/grunk_collection_sfx.gd b/src/player/grunk_collection_sfx/grunk_collection_sfx.gd index 6014d79..b014f5a 100644 --- a/src/player/grunk_collection_sfx/grunk_collection_sfx.gd +++ b/src/player/grunk_collection_sfx/grunk_collection_sfx.gd @@ -9,8 +9,8 @@ extends AudioStreamPlayer @export var counter_decay := 140.0 -@export var base_pitch := 1.5 -@export var pitch_variance := 0.2 +@export var base_pitch_curve: Curve +@export var pitch_variance := 0.1618 @export var noise_rate := 1.0 @export var noise: Noise @@ -42,5 +42,6 @@ func play_random() -> void: var noise_sample := clampf( 2 * noise.get_noise_1d(Engine.get_process_frames() * noise_rate), -1, 1 ) + var base_pitch := base_pitch_curve.sample(World.instance.manager.get_tank_fill_pct()) pitch_scale = base_pitch + (pitch_variance * noise_sample) play() diff --git a/src/player/grunk_collection_sfx/grunk_collection_sfx.tscn b/src/player/grunk_collection_sfx/grunk_collection_sfx.tscn index f5f38a7..5b6564f 100644 --- a/src/player/grunk_collection_sfx/grunk_collection_sfx.tscn +++ b/src/player/grunk_collection_sfx/grunk_collection_sfx.tscn @@ -1,8 +1,13 @@ -[gd_scene load_steps=4 format=3 uid="uid://cbtmhu787diev"] +[gd_scene load_steps=5 format=3 uid="uid://cbtmhu787diev"] [ext_resource type="AudioStream" uid="uid://cj6rj8ujl60e3" path="res://assets/sfx/tools/collect2.wav" id="1_y7it3"] [ext_resource type="Script" uid="uid://dwt66u7ua1to4" path="res://src/player/grunk_collection_sfx/grunk_collection_sfx.gd" id="5_ihwko"] +[sub_resource type="Curve" id="Curve_y7it3"] +_limits = [0.0, 2.4, 0.0, 1.0] +_data = [Vector2(0, 1), 0.0, 8.88538, 0, 0, Vector2(0.125, 1.4), 0.0, 0.0, 0, 0, Vector2(0.5, 1.4), 0.0, 0.0, 0, 0, Vector2(1, 2.4), 6.54458, 0.0, 0, 0] +point_count = 4 + [sub_resource type="FastNoiseLite" id="FastNoiseLite_y7it3"] [node name="GrunkCollectionSFX" type="AudioStreamPlayer"] @@ -11,6 +16,7 @@ volume_db = -4.0 max_polyphony = 3 bus = &"SFX" script = ExtResource("5_ihwko") +base_pitch_curve = SubResource("Curve_y7it3") noise = SubResource("FastNoiseLite_y7it3") [node name="Cooldown" type="Timer" parent="."] diff --git a/src/player/player.tscn b/src/player/player.tscn index d4c78e8..ad7bd24 100644 --- a/src/player/player.tscn +++ b/src/player/player.tscn @@ -837,3 +837,4 @@ stream = ExtResource("39_gsylq") pitch_scale = 1.8 [node name="GrunkCollectionSFX" parent="." instance=ExtResource("40_utg71")] +interval = 160