Title screen background now fades when loading game

This commit is contained in:
ToasterPanic 2025-12-07 14:04:45 -05:00
parent e18abd8bef
commit 1d0e362d54
2 changed files with 30 additions and 14 deletions

View file

@ -50,7 +50,7 @@ volume_db = -4.0
autoplay = true autoplay = true
parameters/looping = true parameters/looping = true
[node name="GPUParticles2D" type="GPUParticles2D" parent="."] [node name="Stars" type="GPUParticles2D" parent="."]
position = Vector2(-1420, 0) position = Vector2(-1420, 0)
amount = 512 amount = 512
texture = ExtResource("2_4rr2b") texture = ExtResource("2_4rr2b")

View file

@ -216,18 +216,20 @@ func _on_new_game_pressed() -> void:
transitioning = true transitioning = true
get_viewport().gui_release_focus() 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"): 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.visible = true
$UI/Control/OverrideSave.modulate.a = 0 $UI/Control/OverrideSave.modulate.a = 0
@ -246,11 +248,23 @@ func _on_new_game_pressed() -> void:
transitioning = false transitioning = false
return return
if global.stats.location == "space":
get_tree().change_scene_to_file("res://scenes/game.tscn")
else: 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: func _on_load_game_pressed() -> void:
if transitioning: return if transitioning: return
@ -264,6 +278,7 @@ func _on_load_game_pressed() -> void:
while i < 6: while i < 6:
$UI/Control/Title.modulate.a -= 0.2 $UI/Control/Title.modulate.a -= 0.2
$Stars.modulate.a -= 0.2
await get_tree().create_timer(0.2).timeout await get_tree().create_timer(0.2).timeout
@ -293,6 +308,7 @@ func _on_yes_override_pressed() -> void:
while i < 6: while i < 6:
$UI/Control/OverrideSave.modulate.a -= 0.2 $UI/Control/OverrideSave.modulate.a -= 0.2
$Stars.modulate.a -= 0.2
await get_tree().create_timer(0.2).timeout await get_tree().create_timer(0.2).timeout