extends Node

func _ready():
	get_tree().paused = true

func start_game():
	$Menu.set_visible(false)
	if not Global.race_started:
		print("Game starting")
		Global.race_started = true
		$GUI.set_visible(true)
		yield($Countdown.start(), "completed")
	get_tree().paused = false

func pause_game():
	$Menu.set_visible(true)
	get_tree().paused = true

func _input(event):
	if event.is_action_pressed("ui_cancel"):
		pause_game()