This repository has been archived on 2023-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
defend-together/client/scripts/singletons/MusicManager.gd

16 lines
362 B
GDScript

extends AudioStreamPlayer
var main_player : AudioStreamPlayer
var looping : bool = false
func _ready():
main_player = self
func play_music(song, loop=true):
var audio_file = "res://assets/audio/music/" + song + ".ogg"
if File.new().file_exists(audio_file):
var track = load(audio_file)
looping = loop
main_player.stream = track
#main_player.play()