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
GDScript3
Raw Normal View History

2020-05-01 01:16:46 +02:00
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()