extends CanvasLayer

var active = false

func _ready():
	$AnimationPlayer.play("MoveIn")

func _process(delta):
	if active:
		var UP = Input.is_action_just_pressed("ui_up")
		var DOWN = Input.is_action_just_pressed("ui_down")
		var SELECT = Input.is_action_just_pressed("shoot")
		var PAUSE = Input.is_action_just_pressed("toggle_pause")
		var BACK = Input.is_action_just_pressed("ui_cancel")
		
		if PAUSE or SELECT or BACK:
			unpause()

func _on_AnimationPlayer_animation_finished(anim_name):
	if anim_name == "MoveIn":
		active = true
	if anim_name == "MoveOut":
		get_tree().paused = false
		queue_free()

func unpause():
	set_process(false)
	$AnimationPlayer.play("MoveOut")
