浏览代码

:wrench: First scritp to capture cancel input

DricomDragon 2 年之前
父节点
当前提交
04b4200bbe
共有 2 个文件被更改,包括 9 次插入1 次删除
  1. 6 0
      godot/component/entity/level/Level.gd
  2. 3 1
      godot/run/levels/heart.tscn

+ 6 - 0
godot/component/entity/level/Level.gd

@@ -0,0 +1,6 @@
+extends Node2D
+
+
+func _input(event: InputEvent) -> void:
+	if event.is_action_pressed("ui_cancel"):
+		print("Get out !")

+ 3 - 1
godot/run/levels/heart.tscn

@@ -1,6 +1,7 @@
-[gd_scene load_steps=8 format=3 uid="uid://38l0xifohua4"]
+[gd_scene load_steps=9 format=3 uid="uid://38l0xifohua4"]
 
 [ext_resource type="PackedScene" uid="uid://bw4uy776cvn5o" path="res://component/entity/line/Line.tscn" id="1_80o1x"]
+[ext_resource type="Script" path="res://component/entity/level/Level.gd" id="1_nqh2i"]
 [ext_resource type="PackedScene" uid="uid://bs4hylgxwbr8y" path="res://component/entity/star/Star.tscn" id="2_cc0ak"]
 [ext_resource type="PackedScene" uid="uid://dkltla4rn3vgv" path="res://component/entity/trigger/Trigger.tscn" id="3_1jckh"]
 
@@ -29,6 +30,7 @@ _data = {
 point_count = 7
 
 [node name="Root" type="Node2D"]
+script = ExtResource("1_nqh2i")
 
 [node name="Lines" type="Node2D" parent="."]