noise.gd 450 B

123456789101112131415161718
  1. extends AudioStreamPlayer3D
  2. const crash_sounds: Array[AudioStream] = [
  3. preload("res://effect/crash/crash0.wav"),
  4. preload("res://effect/crash/crash1.wav"),
  5. preload("res://effect/crash/crash2.wav"),
  6. preload("res://effect/crash/crash3.wav"),
  7. ]
  8. func _ready() -> void:
  9. stream = _pick_random_sound()
  10. play()
  11. func _pick_random_sound() -> AudioStream:
  12. var rand_index: int = randi_range(0, crash_sounds.size() - 1)
  13. return crash_sounds[rand_index]