PirateTreasureHunt/scenes/MusicPlayer.gd

23 lines
610 B
GDScript
Raw Normal View History

2021-07-21 22:08:42 +02:00
extends AudioStreamPlayer
onready var songs = [
2021-07-21 22:11:19 +02:00
preload("res://audio/music/edit_looperman-l-2353443-0126764-yungkimchi-adventure-synthwave-arp.mp3"),
2021-07-21 22:08:42 +02:00
preload("res://audio/music/edit_looperman-l-2648038-0125430-imthewizzy-adventure.mp3"),
2021-07-21 22:11:19 +02:00
preload("res://audio/music/edit_looperman-l-2762820-0244446-nick-mira-type-8bit-adventure.mp3")
2021-07-21 22:08:42 +02:00
]
# Called when the node enters the scene tree for the first time.
func _ready():
pass
func _on_World_level_started():
if songs == null:
return
stop()
var rng = RandomNumberGenerator.new()
rng.randomize()
stream = songs[rng.randi() % len(songs)]
play()