From 1d0e362d54367951b484e1233ab00c5e3e6a1e60 Mon Sep 17 00:00:00 2001 From: ToasterPanic Date: Sun, 7 Dec 2025 14:04:45 -0500 Subject: [PATCH] Title screen background now fades when loading game --- scenes/title.tscn | 2 +- scripts/title.gd | 42 +++++++++++++++++++++++++++++------------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/scenes/title.tscn b/scenes/title.tscn index ec4acbb..592352c 100644 --- a/scenes/title.tscn +++ b/scenes/title.tscn @@ -50,7 +50,7 @@ volume_db = -4.0 autoplay = true parameters/looping = true -[node name="GPUParticles2D" type="GPUParticles2D" parent="."] +[node name="Stars" type="GPUParticles2D" parent="."] position = Vector2(-1420, 0) amount = 512 texture = ExtResource("2_4rr2b") diff --git a/scripts/title.gd b/scripts/title.gd index 25e3f8f..c99cabd 100644 --- a/scripts/title.gd +++ b/scripts/title.gd @@ -216,18 +216,20 @@ func _on_new_game_pressed() -> void: transitioning = true get_viewport().gui_release_focus() - var i = 0 - while i < 6: - $UI/Control/Title.modulate.a -= 0.2 - - await get_tree().create_timer(0.2).timeout - - i += 1 - - $UI/Control/Title.visible = false if FileAccess.file_exists("user://savegame.save"): + var i = 0 + + while i < 6: + $UI/Control/Title.modulate.a -= 0.2 + + await get_tree().create_timer(0.2).timeout + + i += 1 + + $UI/Control/Title.visible = false + $UI/Control/OverrideSave.visible = true $UI/Control/OverrideSave.modulate.a = 0 @@ -246,11 +248,23 @@ func _on_new_game_pressed() -> void: transitioning = false return - - if global.stats.location == "space": - get_tree().change_scene_to_file("res://scenes/game.tscn") else: - get_tree().change_scene_to_file("res://scenes/ground.tscn") + var i = 0 + + while i < 6: + $UI/Control/Title.modulate.a -= 0.2 + $Stars.modulate.a -= 0.2 + + await get_tree().create_timer(0.2).timeout + + i += 1 + + $UI/Control/Title.visible = false + + if global.stats.location == "space": + get_tree().change_scene_to_file("res://scenes/game.tscn") + else: + get_tree().change_scene_to_file("res://scenes/ground.tscn") func _on_load_game_pressed() -> void: if transitioning: return @@ -264,6 +278,7 @@ func _on_load_game_pressed() -> void: while i < 6: $UI/Control/Title.modulate.a -= 0.2 + $Stars.modulate.a -= 0.2 await get_tree().create_timer(0.2).timeout @@ -293,6 +308,7 @@ func _on_yes_override_pressed() -> void: while i < 6: $UI/Control/OverrideSave.modulate.a -= 0.2 + $Stars.modulate.a -= 0.2 await get_tree().create_timer(0.2).timeout