This repository has been archived on 2024-07-02. You can view files and clone it, but cannot push or open issues or pull requests.
HoppyEaster/Scripts/SFX/PlayerAudioManager.gd

23 lines
410 B
GDScript3
Raw Permalink Normal View History

2023-04-12 07:26:44 +00:00
extends Node
@export var player_audio_pool = []
var random_audio : AudioStreamPlayer
func _ready():
pass
func _process(delta):
random_audio_setter()
if !self.get_parent().velocity.is_zero_approx() && !random_audio.is_playing():
random_audio.play()
pass
pass
func random_audio_setter():
random_audio = get_node(player_audio_pool[randi_range(0, 2)])
random_audio.set_max_polyphony(10000)
pass