bugged-racing/music/MusicPlayer.gd

16 lines
308 B
GDScript

extends Node
export var main_theme: AudioStream
var current_theme = null
onready var themes = {"main": main_theme}
onready var player: AudioStreamPlayer = $Player
func play_theme(theme: String) -> void:
if theme != current_theme:
player.stream = themes[theme]
player.play()
current_theme = theme