extends Node2D

signal on_spacebar
onready var transition = $AnimationPlayer

func _ready():
	transition.play("fade_out")
	$Character.animation = "default"

func _process(_delta):
	if Input.is_action_pressed("ui_select"):
		$Character.animation = "wakes"
		yield(get_tree().create_timer(1), "timeout")
		transition.play("fade_in")
		yield( get_node("AnimationPlayer"), "animation_finished" )
		emit_signal("on_spacebar")

func _on_Start_on_spacebar() -> void:
	get_tree().change_scene("res://scenes/Main.tscn")
