DonutBlock.tscn 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. [gd_scene load_steps=15 format=3 uid="uid://bv38ynjkpisyk"]
  2. [ext_resource type="Script" uid="uid://dbu4juvw4veul" path="res://Scripts/Classes/Blocks/DonutBlock.gd" id="1_asdop"]
  3. [ext_resource type="Texture2D" uid="uid://s2miqaqyk4bm" path="res://Assets/Sprites/Blocks/DonutBlock.png" id="1_ydbi0"]
  4. [ext_resource type="Script" uid="uid://cnheej0sxmoxg" path="res://Scripts/Parts/PlayerDetection.gd" id="2_asdop"]
  5. [ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="3_3jqqs"]
  6. [ext_resource type="JSON" path="res://Assets/Sprites/Blocks/DonutBlock.json" id="4_woaa1"]
  7. [sub_resource type="RectangleShape2D" id="RectangleShape2D_skbwb"]
  8. size = Vector2(16, 16)
  9. [sub_resource type="AtlasTexture" id="AtlasTexture_3jqqs"]
  10. atlas = ExtResource("1_ydbi0")
  11. region = Rect2(16, 0, 16, 16)
  12. [sub_resource type="AtlasTexture" id="AtlasTexture_woaa1"]
  13. atlas = ExtResource("1_ydbi0")
  14. region = Rect2(0, 0, 16, 16)
  15. [sub_resource type="SpriteFrames" id="SpriteFrames_6bmau"]
  16. animations = [{
  17. "frames": [{
  18. "duration": 1.0,
  19. "texture": SubResource("AtlasTexture_3jqqs")
  20. }],
  21. "loop": true,
  22. "name": &"Fall",
  23. "speed": 5.0
  24. }, {
  25. "frames": [{
  26. "duration": 1.0,
  27. "texture": SubResource("AtlasTexture_woaa1")
  28. }],
  29. "loop": true,
  30. "name": &"Idle",
  31. "speed": 5.0
  32. }]
  33. [sub_resource type="Animation" id="Animation_633oe"]
  34. resource_name = "Grow"
  35. length = 0.5
  36. tracks/0/type = "value"
  37. tracks/0/imported = false
  38. tracks/0/enabled = true
  39. tracks/0/path = NodePath("Sprite:offset")
  40. tracks/0/interp = 1
  41. tracks/0/loop_wrap = true
  42. tracks/0/keys = {
  43. "times": PackedFloat32Array(0),
  44. "transitions": PackedFloat32Array(1),
  45. "update": 0,
  46. "values": [Vector2(0, 0)]
  47. }
  48. tracks/1/type = "value"
  49. tracks/1/imported = false
  50. tracks/1/enabled = true
  51. tracks/1/path = NodePath("Sprite:scale")
  52. tracks/1/interp = 2
  53. tracks/1/loop_wrap = true
  54. tracks/1/keys = {
  55. "times": PackedFloat32Array(0, 0.5),
  56. "transitions": PackedFloat32Array(1, 1),
  57. "update": 0,
  58. "values": [Vector2(0, 0), Vector2(1, 1)]
  59. }
  60. [sub_resource type="Animation" id="Animation_vf85a"]
  61. length = 0.001
  62. tracks/0/type = "value"
  63. tracks/0/imported = false
  64. tracks/0/enabled = true
  65. tracks/0/path = NodePath("Sprite:offset")
  66. tracks/0/interp = 1
  67. tracks/0/loop_wrap = true
  68. tracks/0/keys = {
  69. "times": PackedFloat32Array(0),
  70. "transitions": PackedFloat32Array(1),
  71. "update": 0,
  72. "values": [Vector2(0, 0)]
  73. }
  74. tracks/1/type = "value"
  75. tracks/1/imported = false
  76. tracks/1/enabled = true
  77. tracks/1/path = NodePath("Sprite:scale")
  78. tracks/1/interp = 1
  79. tracks/1/loop_wrap = true
  80. tracks/1/keys = {
  81. "times": PackedFloat32Array(0),
  82. "transitions": PackedFloat32Array(1),
  83. "update": 0,
  84. "values": [Vector2(1, 1)]
  85. }
  86. [sub_resource type="Animation" id="Animation_aq712"]
  87. resource_name = "Shake"
  88. tracks/0/type = "value"
  89. tracks/0/imported = false
  90. tracks/0/enabled = true
  91. tracks/0/path = NodePath("Sprite:offset")
  92. tracks/0/interp = 2
  93. tracks/0/loop_wrap = true
  94. tracks/0/keys = {
  95. "times": PackedFloat32Array(0, 0.1, 0.2),
  96. "transitions": PackedFloat32Array(1, 1, 1),
  97. "update": 0,
  98. "values": [Vector2(-1, 0), Vector2(1, 0), Vector2(0, 0)]
  99. }
  100. tracks/1/type = "method"
  101. tracks/1/imported = false
  102. tracks/1/enabled = true
  103. tracks/1/path = NodePath(".")
  104. tracks/1/interp = 1
  105. tracks/1/loop_wrap = true
  106. tracks/1/keys = {
  107. "times": PackedFloat32Array(1),
  108. "transitions": PackedFloat32Array(1),
  109. "values": [{
  110. "args": [],
  111. "method": &"start_falling"
  112. }]
  113. }
  114. [sub_resource type="AnimationLibrary" id="AnimationLibrary_srhyq"]
  115. _data = {
  116. &"Grow": SubResource("Animation_633oe"),
  117. &"RESET": SubResource("Animation_vf85a"),
  118. &"Shake": SubResource("Animation_aq712")
  119. }
  120. [sub_resource type="RectangleShape2D" id="RectangleShape2D_obema"]
  121. size = Vector2(15, 2)
  122. [node name="DonutBlock" type="StaticBody2D"]
  123. collision_layer = 6
  124. collision_mask = 0
  125. script = ExtResource("1_asdop")
  126. [node name="Collision" type="CollisionShape2D" parent="."]
  127. shape = SubResource("RectangleShape2D_skbwb")
  128. [node name="Sprite" type="AnimatedSprite2D" parent="."]
  129. sprite_frames = SubResource("SpriteFrames_6bmau")
  130. animation = &"Idle"
  131. autoplay = "Idle"
  132. frame_progress = 0.0124768
  133. [node name="ResourceSetterNew" type="Node" parent="Sprite" node_paths=PackedStringArray("node_to_affect")]
  134. script = ExtResource("3_3jqqs")
  135. node_to_affect = NodePath("..")
  136. property_name = "sprite_frames"
  137. resource_json = ExtResource("4_woaa1")
  138. metadata/_custom_type_script = "uid://cbal8ms2oe1ik"
  139. [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
  140. libraries = {
  141. &"": SubResource("AnimationLibrary_srhyq")
  142. }
  143. [node name="PlayerDetection" type="Area2D" parent="."]
  144. script = ExtResource("2_asdop")
  145. metadata/_custom_type_script = "uid://cnheej0sxmoxg"
  146. [node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerDetection"]
  147. position = Vector2(0, -9)
  148. shape = SubResource("RectangleShape2D_obema")
  149. [node name="FallTimer" type="Timer" parent="."]
  150. wait_time = 5.0
  151. one_shot = true
  152. [connection signal="player_entered" from="PlayerDetection" to="." method="on_player_entered" unbinds=1]
  153. [connection signal="player_exited" from="PlayerDetection" to="." method="on_player_exited" unbinds=1]
  154. [connection signal="timeout" from="FallTimer" to="." method="respawn"]