PSwitch.tscn 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. [gd_scene load_steps=20 format=3 uid="uid://ciddq8ctlj453"]
  2. [ext_resource type="Script" uid="uid://df20kjawaoqcl" path="res://Scripts/Classes/Entities/Objects/PSwitch.gd" id="1_v4mdn"]
  3. [ext_resource type="Texture2D" uid="uid://y81rhybgt7kb" path="res://Assets/Sprites/Items/PSwitch.png" id="1_x602l"]
  4. [ext_resource type="Script" uid="uid://caq1qiwmy0mox" path="res://Scripts/Parts/BetterAnimatedSprite.gd" id="2_6jgcs"]
  5. [ext_resource type="Script" uid="uid://cnheej0sxmoxg" path="res://Scripts/Parts/PlayerDetection.gd" id="3_05vv4"]
  6. [ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="3_mnfbm"]
  7. [ext_resource type="JSON" path="res://Assets/Sprites/Items/PSwitch.json" id="4_1w7q1"]
  8. [ext_resource type="Script" uid="uid://bx6r8sjar6cwr" path="res://Scripts/Classes/Components/BasicStaticMovement.gd" id="4_6jgcs"]
  9. [ext_resource type="Script" uid="uid://c3gg32ivrlq8n" path="res://Scripts/Classes/Components/GibSpawner.gd" id="7_1w7q1"]
  10. [sub_resource type="AtlasTexture" id="AtlasTexture_mnfbm"]
  11. atlas = ExtResource("1_x602l")
  12. region = Rect2(0, 0, 16, 16)
  13. [sub_resource type="AtlasTexture" id="AtlasTexture_1w7q1"]
  14. atlas = ExtResource("1_x602l")
  15. region = Rect2(16, 0, 16, 16)
  16. [sub_resource type="AtlasTexture" id="AtlasTexture_v4mdn"]
  17. atlas = ExtResource("1_x602l")
  18. region = Rect2(32, 0, 16, 16)
  19. [sub_resource type="AtlasTexture" id="AtlasTexture_i4nd2"]
  20. atlas = ExtResource("1_x602l")
  21. region = Rect2(48, 0, 16, 16)
  22. [sub_resource type="SpriteFrames" id="SpriteFrames_eeyhw"]
  23. animations = [{
  24. "frames": [{
  25. "duration": 10.0,
  26. "texture": SubResource("AtlasTexture_mnfbm")
  27. }, {
  28. "duration": 1.0,
  29. "texture": SubResource("AtlasTexture_1w7q1")
  30. }, {
  31. "duration": 1.0,
  32. "texture": SubResource("AtlasTexture_v4mdn")
  33. }, {
  34. "duration": 1.0,
  35. "texture": SubResource("AtlasTexture_1w7q1")
  36. }],
  37. "loop": true,
  38. "name": &"Idle",
  39. "speed": 10.0
  40. }, {
  41. "frames": [{
  42. "duration": 1.0,
  43. "texture": SubResource("AtlasTexture_i4nd2")
  44. }],
  45. "loop": true,
  46. "name": &"Pressed",
  47. "speed": 5.0
  48. }]
  49. [sub_resource type="RectangleShape2D" id="RectangleShape2D_12hsl"]
  50. size = Vector2(12, 5)
  51. [sub_resource type="RectangleShape2D" id="RectangleShape2D_ofd0i"]
  52. size = Vector2(10, 2)
  53. [sub_resource type="Animation" id="Animation_v4mdn"]
  54. resource_name = "Pressed"
  55. length = 0.5
  56. tracks/0/type = "value"
  57. tracks/0/imported = false
  58. tracks/0/enabled = true
  59. tracks/0/path = NodePath("PressedCollision:shape:size")
  60. tracks/0/interp = 1
  61. tracks/0/loop_wrap = true
  62. tracks/0/keys = {
  63. "times": PackedFloat32Array(0),
  64. "transitions": PackedFloat32Array(1),
  65. "update": 0,
  66. "values": [Vector2(12, 5)]
  67. }
  68. tracks/1/type = "value"
  69. tracks/1/imported = false
  70. tracks/1/enabled = true
  71. tracks/1/path = NodePath("PressedCollision:position")
  72. tracks/1/interp = 1
  73. tracks/1/loop_wrap = true
  74. tracks/1/keys = {
  75. "times": PackedFloat32Array(0),
  76. "transitions": PackedFloat32Array(1),
  77. "update": 0,
  78. "values": [Vector2(0, -2.5)]
  79. }
  80. tracks/2/type = "method"
  81. tracks/2/imported = false
  82. tracks/2/enabled = true
  83. tracks/2/path = NodePath(".")
  84. tracks/2/interp = 1
  85. tracks/2/loop_wrap = true
  86. tracks/2/keys = {
  87. "times": PackedFloat32Array(0.5),
  88. "transitions": PackedFloat32Array(1),
  89. "values": [{
  90. "args": [],
  91. "method": &"queue_free"
  92. }]
  93. }
  94. tracks/3/type = "method"
  95. tracks/3/imported = false
  96. tracks/3/enabled = true
  97. tracks/3/path = NodePath("GibSpawner")
  98. tracks/3/interp = 1
  99. tracks/3/loop_wrap = true
  100. tracks/3/keys = {
  101. "times": PackedFloat32Array(0.5),
  102. "transitions": PackedFloat32Array(1),
  103. "values": [{
  104. "args": [],
  105. "method": &"summon_poof"
  106. }]
  107. }
  108. tracks/4/type = "method"
  109. tracks/4/imported = false
  110. tracks/4/enabled = true
  111. tracks/4/path = NodePath("LCollision")
  112. tracks/4/interp = 1
  113. tracks/4/loop_wrap = true
  114. tracks/4/keys = {
  115. "times": PackedFloat32Array(0),
  116. "transitions": PackedFloat32Array(1),
  117. "values": [{
  118. "args": [],
  119. "method": &"queue_free"
  120. }]
  121. }
  122. tracks/5/type = "method"
  123. tracks/5/imported = false
  124. tracks/5/enabled = true
  125. tracks/5/path = NodePath("RCollision")
  126. tracks/5/interp = 1
  127. tracks/5/loop_wrap = true
  128. tracks/5/keys = {
  129. "times": PackedFloat32Array(0),
  130. "transitions": PackedFloat32Array(1),
  131. "values": [{
  132. "args": [],
  133. "method": &"queue_free"
  134. }]
  135. }
  136. [sub_resource type="Animation" id="Animation_i4nd2"]
  137. length = 0.001
  138. [sub_resource type="AnimationLibrary" id="AnimationLibrary_eeyhw"]
  139. _data = {
  140. &"Pressed": SubResource("Animation_v4mdn"),
  141. &"RESET": SubResource("Animation_i4nd2")
  142. }
  143. [sub_resource type="RectangleShape2D" id="RectangleShape2D_v4mdn"]
  144. size = Vector2(12, 12)
  145. [node name="PSwitch" type="CharacterBody2D"]
  146. collision_layer = 33
  147. collision_mask = 6
  148. script = ExtResource("1_v4mdn")
  149. [node name="Sprite" type="AnimatedSprite2D" parent="."]
  150. position = Vector2(0, -8)
  151. sprite_frames = SubResource("SpriteFrames_eeyhw")
  152. animation = &"Idle"
  153. autoplay = "Idle"
  154. offset = Vector2(0, 1)
  155. script = ExtResource("2_6jgcs")
  156. metadata/_custom_type_script = "uid://caq1qiwmy0mox"
  157. [node name="ResourceSetterNew" type="Node" parent="Sprite" node_paths=PackedStringArray("node_to_affect")]
  158. script = ExtResource("3_mnfbm")
  159. node_to_affect = NodePath("..")
  160. property_name = "sprite_frames"
  161. resource_json = ExtResource("4_1w7q1")
  162. metadata/_custom_type_script = "uid://cbal8ms2oe1ik"
  163. [node name="PressedCollision" type="CollisionShape2D" parent="."]
  164. position = Vector2(0, -2.5)
  165. shape = SubResource("RectangleShape2D_12hsl")
  166. one_way_collision = true
  167. [node name="PlayerDetection" type="Area2D" parent="."]
  168. script = ExtResource("3_05vv4")
  169. metadata/_custom_type_script = "uid://cnheej0sxmoxg"
  170. [node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerDetection"]
  171. position = Vector2(0, -13)
  172. shape = SubResource("RectangleShape2D_ofd0i")
  173. [node name="BasicStaticMovement" type="Node" parent="." node_paths=PackedStringArray("visuals")]
  174. script = ExtResource("4_6jgcs")
  175. visuals = NodePath("../Sprite")
  176. metadata/_custom_type_script = "uid://bx6r8sjar6cwr"
  177. [node name="GibSpawner" type="Node" parent="." node_paths=PackedStringArray("visuals")]
  178. script = ExtResource("7_1w7q1")
  179. visuals = NodePath("../Sprite")
  180. gib_type = 2
  181. play_death_sfx = false
  182. metadata/_custom_type_script = "uid://c3gg32ivrlq8n"
  183. [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
  184. libraries = {
  185. &"": SubResource("AnimationLibrary_eeyhw")
  186. }
  187. [node name="LCollision" type="CollisionShape2D" parent="."]
  188. position = Vector2(0, -6)
  189. rotation = 1.5708
  190. shape = SubResource("RectangleShape2D_v4mdn")
  191. one_way_collision = true
  192. [node name="RCollision" type="CollisionShape2D" parent="."]
  193. position = Vector2(0, -6)
  194. rotation = -1.5708
  195. shape = SubResource("RectangleShape2D_v4mdn")
  196. one_way_collision = true
  197. [connection signal="player_entered" from="PlayerDetection" to="." method="on_player_entered"]