extends Control

func _ready() -> void:
	$TopBar/BackButton.pressed.connect(func(): GameManager.go_to_menu())

	var grid := $CenterContainer/GridContainer
	for i in range(1, GameManager.total_levels + 1):
		var button := Button.new()
		button.text = str(i)
		button.custom_minimum_size = Vector2(100, 100)
		if GameManager.is_level_completed(i):
			button.modulate = Color.GREEN
		var level_num := i
		button.pressed.connect(func(): GameManager.go_to_level(level_num))
		grid.add_child(button)
