extends Node

@export var high_label: Label = null
@export var score_label: Label = null
@export var time_label: Label = null
@export var music: AudioStream = null
@export var start_sound: AudioStream = null
@export_file("*.tscn") var scene_path: String = ""


func _ready() -> void:
	Music.load_stream(music)
	Music.play()
	if Globals.total_score > Globals.high_score:
		Globals.high_score = Globals.total_score
		Globals.save_high_score()
	high_label.text = "%05d" % Globals.high_score
	score_label.text = "%05d" % Globals.total_score
	time_label.text = Globals.get_time_string(Globals.total_time)


func _physics_process(_delta: float) -> void:
	if Input.is_action_just_pressed("start"):
		PulseSound0.load_and_play(start_sound)
		await PulseSound0.finished
		get_tree().change_scene_to_file(scene_path)
