class_name StartButton extends Button export (Array, PackedScene) var scenes var _selected_scene: PackedScene func select(index: int) -> void: assert(index >= 0, "Index must be positive") assert(index < scenes.size(), "Index must be within bounds") _selected_scene = scenes[index] func run_selected_scene(): var err := get_tree().change_scene_to(_selected_scene) assert(err == OK) func _on_lab_selected(index: int) -> void: select(index) func _on_self_pressed() -> void: run_selected_scene()