Door.tscn 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. [gd_scene load_steps=20 format=3 uid="uid://u3t1k5j28yap"]
  2. [ext_resource type="Script" uid="uid://cy8cncadvevvt" path="res://Scripts/Classes/Entities/Objects/Door.gd" id="1_8ee2c"]
  3. [ext_resource type="Script" uid="uid://cnheej0sxmoxg" path="res://Scripts/Parts/PlayerDetection.gd" id="1_625dr"]
  4. [ext_resource type="Script" uid="uid://caq1qiwmy0mox" path="res://Scripts/Parts/BetterAnimatedSprite.gd" id="2_8ee2c"]
  5. [ext_resource type="Texture2D" uid="uid://fyxbhdmqfxk5" path="res://Assets/Sprites/Tilesets/Doors.png" id="2_12ofo"]
  6. [ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="3_12ofo"]
  7. [ext_resource type="JSON" path="res://Assets/Sprites/Tilesets/Doors.json" id="4_jfxhu"]
  8. [ext_resource type="Script" uid="uid://ctfbuoxtnnl0q" path="res://Scripts/Classes/Components/EditorPropertyExposer.gd" id="5_8ee2c"]
  9. [ext_resource type="PackedScene" uid="uid://dse5pwhodrqcr" path="res://Scenes/Prefabs/Editor/EditorProperties/TilePropertyIntRangeSpin.tscn" id="6_12ofo"]
  10. [ext_resource type="Script" uid="uid://cpwloakvp672a" path="res://Scripts/Parts/EditorVisibleNode.gd" id="7_jfxhu"]
  11. [sub_resource type="RectangleShape2D" id="RectangleShape2D_penv4"]
  12. size = Vector2(13, 20)
  13. [sub_resource type="AtlasTexture" id="AtlasTexture_kr4bu"]
  14. atlas = ExtResource("2_12ofo")
  15. region = Rect2(48, 0, 16, 32)
  16. [sub_resource type="AtlasTexture" id="AtlasTexture_penv4"]
  17. atlas = ExtResource("2_12ofo")
  18. region = Rect2(32, 0, 16, 32)
  19. [sub_resource type="AtlasTexture" id="AtlasTexture_jfxhu"]
  20. atlas = ExtResource("2_12ofo")
  21. region = Rect2(16, 0, 16, 32)
  22. [sub_resource type="SpriteFrames" id="SpriteFrames_kr4bu"]
  23. animations = [{
  24. "frames": [{
  25. "duration": 1.0,
  26. "texture": SubResource("AtlasTexture_kr4bu")
  27. }, {
  28. "duration": 1.0,
  29. "texture": SubResource("AtlasTexture_penv4")
  30. }, {
  31. "duration": 1.0,
  32. "texture": SubResource("AtlasTexture_jfxhu")
  33. }],
  34. "loop": false,
  35. "name": &"Close",
  36. "speed": 15.0
  37. }, {
  38. "frames": [{
  39. "duration": 1.0,
  40. "texture": SubResource("AtlasTexture_jfxhu")
  41. }],
  42. "loop": true,
  43. "name": &"Idle",
  44. "speed": 5.0
  45. }, {
  46. "frames": [{
  47. "duration": 1.0,
  48. "texture": SubResource("AtlasTexture_jfxhu")
  49. }, {
  50. "duration": 1.0,
  51. "texture": SubResource("AtlasTexture_penv4")
  52. }, {
  53. "duration": 1.0,
  54. "texture": SubResource("AtlasTexture_kr4bu")
  55. }],
  56. "loop": false,
  57. "name": &"Open",
  58. "speed": 10.0
  59. }]
  60. [sub_resource type="GDScript" id="GDScript_jfxhu"]
  61. script/source = "extends Node
  62. static var colour_ids := {}
  63. func _process(_delta: float) -> void:
  64. $\"../LevelEditorVisibleNode/Label\".text = str(owner.door_id)
  65. "
  66. [sub_resource type="Animation" id="Animation_hk64y"]
  67. resource_name = "Locked"
  68. length = 0.1
  69. tracks/0/type = "value"
  70. tracks/0/imported = false
  71. tracks/0/enabled = true
  72. tracks/0/path = NodePath("Sprite:scale")
  73. tracks/0/interp = 1
  74. tracks/0/loop_wrap = true
  75. tracks/0/keys = {
  76. "times": PackedFloat32Array(0),
  77. "transitions": PackedFloat32Array(1),
  78. "update": 0,
  79. "values": [Vector2(1, 1)]
  80. }
  81. tracks/1/type = "value"
  82. tracks/1/imported = false
  83. tracks/1/enabled = true
  84. tracks/1/path = NodePath("Sprite:position")
  85. tracks/1/interp = 2
  86. tracks/1/loop_wrap = true
  87. tracks/1/keys = {
  88. "times": PackedFloat32Array(0, 0.03333333, 0.06666666, 0.099999994),
  89. "transitions": PackedFloat32Array(1, 1, 1, 1),
  90. "update": 0,
  91. "values": [Vector2(0, 0), Vector2(1, 0), Vector2(-1, 0), Vector2(0, 0)]
  92. }
  93. [sub_resource type="Animation" id="Animation_uba0u"]
  94. length = 0.001
  95. tracks/0/type = "value"
  96. tracks/0/imported = false
  97. tracks/0/enabled = true
  98. tracks/0/path = NodePath("Sprite:scale")
  99. tracks/0/interp = 1
  100. tracks/0/loop_wrap = true
  101. tracks/0/keys = {
  102. "times": PackedFloat32Array(0),
  103. "transitions": PackedFloat32Array(1),
  104. "update": 0,
  105. "values": [Vector2(1, 1)]
  106. }
  107. tracks/1/type = "value"
  108. tracks/1/imported = false
  109. tracks/1/enabled = true
  110. tracks/1/path = NodePath("Sprite:position")
  111. tracks/1/interp = 1
  112. tracks/1/loop_wrap = true
  113. tracks/1/keys = {
  114. "times": PackedFloat32Array(0),
  115. "transitions": PackedFloat32Array(1),
  116. "update": 0,
  117. "values": [Vector2(0, 0)]
  118. }
  119. [sub_resource type="Animation" id="Animation_kr4bu"]
  120. resource_name = "Unlock"
  121. length = 0.2
  122. tracks/0/type = "value"
  123. tracks/0/imported = false
  124. tracks/0/enabled = true
  125. tracks/0/path = NodePath("Sprite:scale")
  126. tracks/0/interp = 2
  127. tracks/0/loop_wrap = true
  128. tracks/0/keys = {
  129. "times": PackedFloat32Array(0, 0.1),
  130. "transitions": PackedFloat32Array(1, 1),
  131. "update": 0,
  132. "values": [Vector2(1.5, 1.5), Vector2(1, 1)]
  133. }
  134. [sub_resource type="AnimationLibrary" id="AnimationLibrary_hk64y"]
  135. _data = {
  136. &"Locked": SubResource("Animation_hk64y"),
  137. &"RESET": SubResource("Animation_uba0u"),
  138. &"Unlock": SubResource("Animation_kr4bu")
  139. }
  140. [node name="Door" type="Node2D" groups=["Doors"]]
  141. z_index = -5
  142. script = ExtResource("1_8ee2c")
  143. [node name="PlayerDetection" type="Area2D" parent="."]
  144. script = ExtResource("1_625dr")
  145. metadata/_custom_type_script = "uid://cnheej0sxmoxg"
  146. [node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerDetection"]
  147. position = Vector2(0, -10)
  148. shape = SubResource("RectangleShape2D_penv4")
  149. [node name="Sprite" type="AnimatedSprite2D" parent="."]
  150. sprite_frames = SubResource("SpriteFrames_kr4bu")
  151. animation = &"Close"
  152. autoplay = "Idle"
  153. frame = 2
  154. frame_progress = 1.0
  155. offset = Vector2(0, -16)
  156. script = ExtResource("2_8ee2c")
  157. do_offset = false
  158. metadata/_custom_type_script = "uid://caq1qiwmy0mox"
  159. [node name="ResourceSetterNew" type="Node" parent="Sprite" node_paths=PackedStringArray("node_to_affect")]
  160. script = ExtResource("3_12ofo")
  161. node_to_affect = NodePath("..")
  162. property_name = "sprite_frames"
  163. resource_json = ExtResource("4_jfxhu")
  164. metadata/_custom_type_script = "uid://cbal8ms2oe1ik"
  165. [node name="EditorPropertyExposer" type="Node" parent="."]
  166. script = ExtResource("5_8ee2c")
  167. properties = Array[String](["door_id", "sublevel_id"])
  168. properties_force_selector = Dictionary[String, PackedScene]({
  169. "door_id": ExtResource("6_12ofo")
  170. })
  171. metadata/_custom_type_script = "uid://ctfbuoxtnnl0q"
  172. [node name="LevelEditorVisibleNode" type="Node2D" parent="."]
  173. process_mode = 3
  174. visibility_layer = 2
  175. z_index = 10
  176. z_as_relative = false
  177. script = ExtResource("7_jfxhu")
  178. metadata/_custom_type_script = "uid://cpwloakvp672a"
  179. [node name="Label" type="Label" parent="LevelEditorVisibleNode"]
  180. offset_left = -16.0
  181. offset_top = -32.0
  182. offset_right = 16.0
  183. offset_bottom = -16.0
  184. theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
  185. text = "1"
  186. horizontal_alignment = 1
  187. [node name="Node" type="Node" parent="."]
  188. process_mode = 3
  189. script = SubResource("GDScript_jfxhu")
  190. [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
  191. libraries = {
  192. &"": SubResource("AnimationLibrary_hk64y")
  193. }
  194. [connection signal="updated" from="." to="Node" method="update_line"]