Popper.gd 334 B

12345678910111213141516171819
  1. extends Spatial
  2. class_name Popper
  3. var message_sound = preload("res://message.ogg")
  4. var prev_sp
  5. func play_sound():
  6. if is_instance_valid(prev_sp):
  7. prev_sp.pitch_scale = 0.4 #LIFEHACK!!! No soundlevel rip!!!
  8. var sp =SDStreamPlayer3D.new()
  9. sp.unit_size = 0.1
  10. sp.stream = message_sound
  11. add_child(sp)
  12. sp.play()
  13. prev_sp = sp