extends Node2D ## Title screen: a big core with balls bouncing around it, and the saved level. const BALL_SCENE := preload("res://scenes/ball.tscn") var _level := 0 func _ready() -> void: var screen := get_viewport_rect().size $Core.position = Vector2(screen.x / 2.0, screen.y * 0.25) for i in 10: var ball: Ball = BALL_SCENE.instantiate() ball.position = Vector2(screen.x / 2.0, screen.y - Params.BALL_RADIUS * 2.0) $Balls.add_child(ball) ball.throw() var progress := Progress.load_level() _level = progress[0] if _level != 0: $UI/LevelInfo.text = Params.MSG_LEVEL_BACK % [_level, progress[1]] $UI/Start.pressed.connect(_on_start_pressed) func _on_start_pressed() -> void: Progress.current_level = _level get_tree().change_scene_to_file("res://scenes/game.tscn")