瀏覽代碼

:sparkles: added exit transition as well

Felix Bytow 10 月之前
父節點
當前提交
763d84dbd2
共有 1 個文件被更改,包括 7 次插入1 次删除
  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