56 lines
1.7 KiB
GDScript3
56 lines
1.7 KiB
GDScript3
|
extends Node3D
|
||
|
|
||
|
|
||
|
@onready var mapNode = get_node("/root/toyfactory")
|
||
|
var mapPath = "res://scenes/toyfactory.tscn"
|
||
|
var audio_stream_player = AudioStreamPlayer.new()
|
||
|
|
||
|
func _ready():
|
||
|
Global.currentMapNode = mapNode
|
||
|
Global.currentMapPath = mapPath
|
||
|
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
|
||
|
|
||
|
|
||
|
func play_music(music):
|
||
|
audio_stream_player.set_stream(music)
|
||
|
add_child(audio_stream_player)
|
||
|
audio_stream_player.play()
|