Fix fading system

This commit is contained in:
Ategon 2024-08-28 21:07:57 -04:00
parent 261510de9c
commit 4c066b821c

View file

@ -37,21 +37,19 @@ func _play():
print("NO SONG COULD BE FOUND") print("NO SONG COULD BE FOUND")
return return
if volume_tween: if volume_tween:
volume_tween.kill() volume_tween.kill()
volume_tween = create_tween() audio_stream_player.volume_db = -30
volume_tween.tween_property(audio_stream_player, "volume_db", -30, 3) audio_stream_player.stream = load(song.track)
volume_tween.tween_callback(func():
audio_stream_player.stream = load(song.track)
)
volume_tween.tween_property(audio_stream_player, "volume_db", 0, 3)
audio_stream_player.play() audio_stream_player.play()
music_display.show_song(song) music_display.show_song(song)
current_track = song current_track = song
volume_tween = create_tween()
volume_tween.tween_property(audio_stream_player, "volume_db", 0, 3)
volume_tween.tween_interval(audio_stream_player.stream.get_length() - 3)
volume_tween.tween_property(audio_stream_player, "volume_db", -30, 3)
func _stop(): func _stop():