D3/Level/test_level_01.gd
2025-05-10 23:19:52 +08:00

19 lines
554 B
GDScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

extends Node2D # 或者extends Node取决于你的level场景的根节点类型
func _ready():
# 初始化时的设置(如果需要的话)
pass
func _process(_delta):
# 检测是否按下重置按键
if Input.is_action_just_pressed("Level_Reset"):
reset_level()
func reset_level():
# 方法1重新加载当前场景
get_tree().reload_current_scene()
# 或者方法2如果你想要更精确的控制
# var current_scene_path = scene_file_path # 获取当前场景路径
# get_tree().change_scene_to_file(current_scene_path)