project_teddy/scripts/maps/toyland.gd
2023-03-11 18:50:43 -07:00

53 lines
1.6 KiB
GDScript

extends Node
@onready var mapNode = get_node("/root/toyland")
var audio_stream_player = AudioStreamPlayer.new()
func _ready():
Global.currentMapNode = mapNode
Global.playerHealth = 100
Global.fatigue = 100
Global.playerYDeath = -100
func _process(delta):
if audio_stream_player.playing == false:
var randomnum = RandomNumberGenerator.new().randi_range(0, 6)
if randomnum == 0:
play_music(load("res://music/alexander-nakarada-chase.mp3"))
Global.musicName = "Chase"
Global.musicAuthor = "Alexander Nakarada"
elif randomnum == 1:
play_music(load("res://music/DRIVE.mp3"))
Global.musicName = "DRIVE"
Global.musicAuthor = "Alex-Productions"
elif randomnum == 2:
play_music(load("res://music/Fluffing-a-Duck.mp3"))
Global.musicName = "Fluffing a Duck"
Global.musicAuthor = "Kevin MacLeod"
elif randomnum == 3:
play_music(load("res://music/Monkeys-Spinning-Monkeys.mp3"))
Global.musicName = "Monkeys Spinning Monkeys"
Global.musicAuthor = "Kevin MacLeod"
elif randomnum == 4:
play_music(load("res://music/Run-Amok.mp3"))
Global.musicName = "Run Amok"
Global.musicAuthor = "Kevin MacLeod"
elif randomnum == 5:
play_music(load("res://music/Sneaky-Snitch.mp3"))
Global.musicName = "Sneaky Snitch"
Global.musicAuthor = "Kevin MacLeod"
elif randomnum == 6:
play_music(load("res://music/Wallpaper.mp3"))
Global.musicName = "Wallpaper"
Global.musicAuthor = "Kevin MacLeod"
else:
print("This shouldn't ever be called, toyland.gd")
Global.musicUpdated = true
print("hehe")
func play_music(music):
audio_stream_player.set_stream(music)
add_child(audio_stream_player)
audio_stream_player.play()