project_teddy/scripts/maps/islands.gd
2023-05-27 14:57:15 -06:00

54 lines
1.7 KiB
GDScript

extends Node3D
@onready var mapNode = get_node("/root/islands")
var mapPath = "res://scenes/islands.tscn"
var audio_stream_player = AudioStreamPlayer.new()
func _ready():
Global.currentMapNode = mapNode
Global.currentMapPath = mapPath
Global.playerHealth = 100
Global.fatigue = 100
Global.playerYDeath = -25
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, forrest.gd")
Global.musicUpdated = true
func play_music(music):
audio_stream_player.set_stream(music)
add_child(audio_stream_player)
audio_stream_player.play()