Browse Source

:sparkles: added exit transition as well

Felix Bytow 10 tháng trước cách đây
mục cha
commit
763d84dbd2
1 tập tin đã thay đổi với 7 bổ sung1 xóa
  1. 7 1
      screens/game.gd

+ 7 - 1
screens/game.gd

@@ -10,7 +10,13 @@ func _ready() -> void:
 
 func _process(_delta: float) -> void:
 	if Input.is_action_pressed("ui_cancel"):
-		get_tree().change_scene_to_file("res://screens/main_menu.tscn")
+		var tree = get_tree()
+		transition.text = ""
+		transition.slide_in()
+		await transition.game_fully_hidden
+		tree.paused = true
+		tree.change_scene_to_file("res://screens/main_menu.tscn")
+		tree.paused = false
 
 func _on_timer_timeout():
 	health_bar.health += direction