extends Control

const intro_subtitles = [
	[0.5, constants.MISC, "*Phone ringing*"],
	[8.2, constants.MISC, "*Click*"],
	[8.62, constants.DEAN, "Wake up, Joshua. You need to go get your transcript..."],
	[13.9, constants.JOSHUA, "But sir, it's 12 in-"],
	[14.9, constants.DEAN, "I don't care that it's 12 in the morning, go to Higland High now"],
	[20, constants.MISC, "*Phone hangs up*"],
	[24.45, constants.MISC, "*Door opens*"],
	[27.7, constants.MISC, "*Car starts*"],
	[31.5, constants.MISC, "*Car begins driving*"],
	[37, constants.MISC, "*Car drives away*"],
]

var prev_items = 0


func _ready():
	get_tree().call_group("subtitle","add_subtitle",constants.MISC,"Press any key to skip")
	for item in intro_subtitles:
		yield(get_tree().create_timer(item[0]-prev_items), "timeout")
		prev_items = item[0]
		print(prev_items)
		get_tree().call_group("subtitle","add_subtitle",item[1],item[2])

func _on_AudioStreamPlayer_finished():
	next()


func _input(event):
	if event is InputEventKey and event.pressed:
		next()

func next():
	get_tree().change_scene("res://Maps/TestMap2.tscn")
