Allow the game over screen to grab proper focus when it opens

This commit is contained in:
2024-05-13 20:02:52 -04:00
parent b8cdc82888
commit 914a6e4010
4 changed files with 11 additions and 22 deletions

View File

@ -35,7 +35,6 @@ func game_over() -> void:
# Wait 1 second before showing the game over screen for "dramatic" effect
await get_tree().create_timer(1.0).timeout
$UI/GameOverScreen.visible = true
# TODO: Set focus on one of the buttons once the game over screen when shown
func increase_score(comet_size : int) -> void:
# We add one since comet_size starts count at 0
@ -46,3 +45,6 @@ func update_ui()-> void:
# Label strings must be all caps for font to render proper
$UI/Score.text = "SCORE: " + str(score)
$UI/Level.text = "LEVEL: " + str(level)

View File

@ -4,5 +4,7 @@ func _on_retry_button_pressed() -> void:
get_tree().change_scene_to_file("res://scenes/game.tscn")
func _on_quit_button_pressed() -> void:
# TODO: Go to title screen instead of killing the game
get_tree().quit()
get_tree().change_scene_to_file("res://scenes/title_screen.tscn")
func _on_visibility_changed() -> void:
$Panel/RetryButton.grab_focus()