extends MenuButton

var popup:PopupMenu

func _index_pressed(idx: int):
	if idx == 0:
		get_tree().change_scene_to_file("res://scenes/config.tscn")
	elif idx == 1:
		get_tree().quit()

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	popup = get_popup()
	popup.index_pressed.connect(_index_pressed)

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	self_modulate.a = 1 if popup.visible else GlobalConfig.menu_opacity