extends Node @onready var sfx_crash: AudioStreamPlayer = $SFXCrash @onready var sfx_crash_car_to_car: AudioStreamPlayer = $SFXCrashCarToCar @onready var sfx_sliding: AudioStreamPlayer = $SFXSliding # Called when the node enters the scene tree for the first time. func _ready() -> void: pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: pass func crashBarrier(velocity): if not sfx_crash.playing: #print("Play Crash sound v="+str(velocity)) sfx_crash.set_volume_db(linear_to_db(clamp(remap(velocity, 100,300,0.0,1.0),0,1))) sfx_crash.play() func crashCarToCar(velocity): if not sfx_crash_car_to_car.playing: #print("Play sfx_crash_car_to_car sound v="+str(velocity)) sfx_crash_car_to_car.set_volume_db(linear_to_db(clamp(remap(velocity, 200,300,0.0,1.0),0,1))) sfx_crash_car_to_car.play() func sliding(velocity): if not sfx_sliding.playing: sfx_sliding.set_volume_db(linear_to_db(clamp(remap(velocity, 100,300,0.0,1.0),0,1))) sfx_sliding.play()