Spike.tscn 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. [gd_scene load_steps=30 format=3 uid="uid://dbob4iexex6yp"]
  2. [ext_resource type="Script" uid="uid://4isgtypd8yqc" path="res://Scripts/Classes/Entities/Enemies/Spike.gd" id="1_5cp2h"]
  3. [ext_resource type="Texture2D" uid="uid://drf0xqp7af1bx" path="res://Assets/Sprites/Enemies/Spike.png" id="2_dd7on"]
  4. [ext_resource type="Script" uid="uid://caq1qiwmy0mox" path="res://Scripts/Parts/BetterAnimatedSprite.gd" id="3_5cp2h"]
  5. [ext_resource type="Texture2D" uid="uid://dtn3el3cobo42" path="res://Assets/Sprites/Items/SpikeBall.png" id="3_m8jkd"]
  6. [ext_resource type="Script" uid="uid://chj8hu207lrh" path="res://Scripts/Classes/Components/EnemyPlayerDetection.gd" id="3_wml2i"]
  7. [ext_resource type="Script" uid="uid://c3gg32ivrlq8n" path="res://Scripts/Classes/Components/GibSpawner.gd" id="4_w6nqc"]
  8. [ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="5_ddx5o"]
  9. [ext_resource type="Script" uid="uid://5octqlf4ohel" path="res://Scripts/Classes/Components/ScoreNoteSpawner.gd" id="5_w6nqc"]
  10. [ext_resource type="JSON" path="res://Assets/Sprites/Enemies/Spike.json" id="6_dhnkc"]
  11. [ext_resource type="Script" uid="uid://dri2d5jtu0fbq" path="res://Scripts/Classes/Components/FireballDetection.gd" id="6_iboug"]
  12. [ext_resource type="JSON" path="res://Assets/Sprites/Items/SpikeBall.json" id="7_l0d5l"]
  13. [ext_resource type="Script" uid="uid://bbww34oiexbx2" path="res://Scripts/Classes/Components/ShellDetection.gd" id="7_m8jkd"]
  14. [ext_resource type="Script" uid="uid://dlq6o2rg1x7in" path="res://Scripts/Classes/Components/BasicEnemyMovement.gd" id="12_dhnkc"]
  15. [ext_resource type="Script" uid="uid://bx6r8sjar6cwr" path="res://Scripts/Classes/Components/BasicStaticMovement.gd" id="13_vg6vt"]
  16. [ext_resource type="Script" uid="uid://ctfbuoxtnnl0q" path="res://Scripts/Classes/Components/EditorPropertyExposer.gd" id="14_px5di"]
  17. [ext_resource type="Script" uid="uid://ba18grqjixded" path="res://Scripts/Classes/Components/ExplosionDetection.gd" id="15_5pdnx"]
  18. [sub_resource type="AtlasTexture" id="AtlasTexture_5cp2h"]
  19. atlas = ExtResource("2_dd7on")
  20. region = Rect2(32, 0, 16, 16)
  21. [sub_resource type="AtlasTexture" id="AtlasTexture_w1p0q"]
  22. atlas = ExtResource("2_dd7on")
  23. region = Rect2(48, 0, 16, 16)
  24. [sub_resource type="AtlasTexture" id="AtlasTexture_ddx5o"]
  25. atlas = ExtResource("2_dd7on")
  26. region = Rect2(64, 0, 16, 16)
  27. [sub_resource type="AtlasTexture" id="AtlasTexture_dhnkc"]
  28. atlas = ExtResource("2_dd7on")
  29. region = Rect2(80, 0, 16, 16)
  30. [sub_resource type="AtlasTexture" id="AtlasTexture_wml2i"]
  31. atlas = ExtResource("2_dd7on")
  32. region = Rect2(16, 0, 16, 16)
  33. [sub_resource type="AtlasTexture" id="AtlasTexture_w6nqc"]
  34. atlas = ExtResource("2_dd7on")
  35. region = Rect2(0, 0, 16, 16)
  36. [sub_resource type="SpriteFrames" id="SpriteFrames_0q3vy"]
  37. animations = [{
  38. "frames": [{
  39. "duration": 1.0,
  40. "texture": SubResource("AtlasTexture_5cp2h")
  41. }, {
  42. "duration": 2.0,
  43. "texture": SubResource("AtlasTexture_w1p0q")
  44. }, {
  45. "duration": 1.0,
  46. "texture": SubResource("AtlasTexture_ddx5o")
  47. }, {
  48. "duration": 1.0,
  49. "texture": SubResource("AtlasTexture_dhnkc")
  50. }],
  51. "loop": false,
  52. "name": &"GrabBall",
  53. "speed": 10.0
  54. }, {
  55. "frames": [{
  56. "duration": 1.0,
  57. "texture": SubResource("AtlasTexture_wml2i")
  58. }, {
  59. "duration": 1.0,
  60. "texture": SubResource("AtlasTexture_w6nqc")
  61. }],
  62. "loop": true,
  63. "name": &"Idle",
  64. "speed": 5.0
  65. }]
  66. [sub_resource type="Animation" id="Animation_vg6vt"]
  67. resource_name = "BallSpawn"
  68. tracks/0/type = "method"
  69. tracks/0/imported = false
  70. tracks/0/enabled = true
  71. tracks/0/path = NodePath("Sprite")
  72. tracks/0/interp = 1
  73. tracks/0/loop_wrap = true
  74. tracks/0/keys = {
  75. "times": PackedFloat32Array(0),
  76. "transitions": PackedFloat32Array(1),
  77. "values": [{
  78. "args": [&"GrabBall", 1.0, false],
  79. "method": &"play"
  80. }]
  81. }
  82. tracks/1/type = "value"
  83. tracks/1/imported = false
  84. tracks/1/enabled = true
  85. tracks/1/path = NodePath("Sprite/Ball:visible")
  86. tracks/1/interp = 1
  87. tracks/1/loop_wrap = true
  88. tracks/1/keys = {
  89. "times": PackedFloat32Array(0),
  90. "transitions": PackedFloat32Array(1),
  91. "update": 1,
  92. "values": [true]
  93. }
  94. tracks/2/type = "value"
  95. tracks/2/imported = false
  96. tracks/2/enabled = true
  97. tracks/2/path = NodePath("Sprite/Ball:position")
  98. tracks/2/interp = 2
  99. tracks/2/loop_wrap = true
  100. tracks/2/keys = {
  101. "times": PackedFloat32Array(0, 0.3, 0.4, 0.866667, 0.966667, 1),
  102. "transitions": PackedFloat32Array(1, 1, 1e-05, 1, 1, 1),
  103. "update": 0,
  104. "values": [Vector2(0, 0), Vector2(0, -17), Vector2(0, -14), Vector2(0, -14), Vector2(-3, -14), Vector2(0, -14)]
  105. }
  106. [sub_resource type="Animation" id="Animation_5cp2h"]
  107. resource_name = "Idle"
  108. tracks/0/type = "method"
  109. tracks/0/imported = false
  110. tracks/0/enabled = true
  111. tracks/0/path = NodePath("Sprite")
  112. tracks/0/interp = 1
  113. tracks/0/loop_wrap = true
  114. tracks/0/keys = {
  115. "times": PackedFloat32Array(0),
  116. "transitions": PackedFloat32Array(1),
  117. "values": [{
  118. "args": [&"Idle", 1.0, false],
  119. "method": &"play"
  120. }]
  121. }
  122. tracks/1/type = "value"
  123. tracks/1/imported = false
  124. tracks/1/enabled = true
  125. tracks/1/path = NodePath("Sprite/Ball:visible")
  126. tracks/1/interp = 1
  127. tracks/1/loop_wrap = true
  128. tracks/1/keys = {
  129. "times": PackedFloat32Array(0),
  130. "transitions": PackedFloat32Array(1),
  131. "update": 1,
  132. "values": [false]
  133. }
  134. [sub_resource type="Animation" id="Animation_w1p0q"]
  135. length = 0.001
  136. tracks/0/type = "value"
  137. tracks/0/imported = false
  138. tracks/0/enabled = true
  139. tracks/0/path = NodePath("Sprite/Ball:visible")
  140. tracks/0/interp = 1
  141. tracks/0/loop_wrap = true
  142. tracks/0/keys = {
  143. "times": PackedFloat32Array(0),
  144. "transitions": PackedFloat32Array(1),
  145. "update": 1,
  146. "values": [false]
  147. }
  148. tracks/1/type = "value"
  149. tracks/1/imported = false
  150. tracks/1/enabled = true
  151. tracks/1/path = NodePath("Sprite/Ball:position")
  152. tracks/1/interp = 1
  153. tracks/1/loop_wrap = true
  154. tracks/1/keys = {
  155. "times": PackedFloat32Array(0),
  156. "transitions": PackedFloat32Array(1),
  157. "update": 0,
  158. "values": [Vector2(0, 0)]
  159. }
  160. [sub_resource type="AnimationLibrary" id="AnimationLibrary_px5di"]
  161. _data = {
  162. &"BallSpawn": SubResource("Animation_vg6vt"),
  163. &"Idle": SubResource("Animation_5cp2h"),
  164. &"RESET": SubResource("Animation_w1p0q")
  165. }
  166. [sub_resource type="RectangleShape2D" id="RectangleShape2D_r5um5"]
  167. size = Vector2(10, 8)
  168. [sub_resource type="RectangleShape2D" id="RectangleShape2D_dd7on"]
  169. size = Vector2(10, 12)
  170. [node name="Spike" type="CharacterBody2D" node_paths=PackedStringArray("on_screen_enabler", "score_note_adder") groups=["Enemies"]]
  171. collision_layer = 16
  172. collision_mask = 2
  173. script = ExtResource("1_5cp2h")
  174. on_screen_enabler = NodePath("VisibleOnScreenEnabler2D")
  175. score_note_adder = NodePath("ScoreNoteSpawner")
  176. metadata/_custom_type_script = "uid://bpydbpyjk1mt4"
  177. [node name="Sprite" type="AnimatedSprite2D" parent="."]
  178. position = Vector2(0, -8)
  179. scale = Vector2(-1, 1)
  180. sprite_frames = SubResource("SpriteFrames_0q3vy")
  181. animation = &"GrabBall"
  182. autoplay = "Idle"
  183. frame = 3
  184. frame_progress = 1.0
  185. offset = Vector2(0, 1)
  186. flip_h = true
  187. script = ExtResource("3_5cp2h")
  188. metadata/_custom_type_script = "uid://caq1qiwmy0mox"
  189. [node name="Animations" type="AnimationPlayer" parent="Sprite"]
  190. unique_name_in_owner = true
  191. root_node = NodePath("../..")
  192. libraries = {
  193. &"": SubResource("AnimationLibrary_px5di")
  194. }
  195. [node name="ResourceSetterNew" type="Node" parent="Sprite" node_paths=PackedStringArray("node_to_affect")]
  196. script = ExtResource("5_ddx5o")
  197. node_to_affect = NodePath("..")
  198. property_name = "sprite_frames"
  199. resource_json = ExtResource("6_dhnkc")
  200. metadata/_custom_type_script = "uid://cbal8ms2oe1ik"
  201. [node name="Ball" type="Sprite2D" parent="Sprite"]
  202. unique_name_in_owner = true
  203. visible = false
  204. show_behind_parent = true
  205. rotation = 3.14159
  206. scale = Vector2(1, -1)
  207. texture = ExtResource("3_m8jkd")
  208. [node name="ResourceSetterNew" type="Node" parent="Sprite/Ball" node_paths=PackedStringArray("node_to_affect")]
  209. script = ExtResource("5_ddx5o")
  210. node_to_affect = NodePath("..")
  211. property_name = "texture"
  212. mode = 1
  213. resource_json = ExtResource("7_l0d5l")
  214. metadata/_custom_type_script = "uid://cbal8ms2oe1ik"
  215. [node name="Collision" type="CollisionShape2D" parent="."]
  216. position = Vector2(0, -4)
  217. shape = SubResource("RectangleShape2D_r5um5")
  218. [node name="Hitbox" type="Area2D" parent="."]
  219. [node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
  220. position = Vector2(0, -6)
  221. shape = SubResource("RectangleShape2D_dd7on")
  222. [node name="EnemyPlayerDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
  223. script = ExtResource("3_wml2i")
  224. hitbox = NodePath("../Hitbox")
  225. metadata/_custom_type_script = "uid://chj8hu207lrh"
  226. [node name="GibSpawner" type="Node" parent="." node_paths=PackedStringArray("visuals")]
  227. script = ExtResource("4_w6nqc")
  228. visuals = NodePath("../Sprite")
  229. metadata/_custom_type_script = "uid://c3gg32ivrlq8n"
  230. [node name="ScoreNoteSpawner" type="Node" parent="."]
  231. script = ExtResource("5_w6nqc")
  232. metadata/_custom_type_script = "uid://5octqlf4ohel"
  233. [node name="FireballDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
  234. script = ExtResource("6_iboug")
  235. hitbox = NodePath("../Hitbox")
  236. play_sfx_on_hit = true
  237. metadata/_custom_type_script = "uid://dri2d5jtu0fbq"
  238. [node name="ShellDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
  239. script = ExtResource("7_m8jkd")
  240. hitbox = NodePath("../Hitbox")
  241. metadata/_custom_type_script = "uid://bbww34oiexbx2"
  242. [node name="ThrowTimer" type="Timer" parent="."]
  243. wait_time = 5.0
  244. [node name="VisibleOnScreenEnabler2D" type="VisibleOnScreenEnabler2D" parent="."]
  245. position = Vector2(0, -9)
  246. [node name="Movement" type="Node" parent="." node_paths=PackedStringArray("visuals")]
  247. script = ExtResource("12_dhnkc")
  248. auto_call = false
  249. visuals = NodePath("../Sprite")
  250. [node name="TurnTimer" type="Timer" parent="."]
  251. wait_time = 2.0
  252. [node name="StaticMovement" type="Node" parent="." node_paths=PackedStringArray("visuals")]
  253. script = ExtResource("13_vg6vt")
  254. auto_call = false
  255. visuals = NodePath("../Sprite")
  256. [node name="EditorPropertyExposer" type="Node" parent="."]
  257. script = ExtResource("14_px5di")
  258. properties = Array[String](["can_move"])
  259. [node name="ExplosionDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
  260. script = ExtResource("15_5pdnx")
  261. hitbox = NodePath("../Hitbox")
  262. metadata/_custom_type_script = "uid://ba18grqjixded"
  263. [connection signal="killed" from="." to="GibSpawner" method="summon_gib"]
  264. [connection signal="invincible_player_hit" from="EnemyPlayerDetection" to="." method="die_from_object"]
  265. [connection signal="invincible_player_hit" from="EnemyPlayerDetection" to="ScoreNoteSpawner" method="spawn_note" binds= [500]]
  266. [connection signal="player_hit" from="EnemyPlayerDetection" to="." method="damage_player"]
  267. [connection signal="player_stomped_on" from="EnemyPlayerDetection" to="GibSpawner" method="stomp_die"]
  268. [connection signal="fireball_hit" from="FireballDetection" to="." method="die_from_object"]
  269. [connection signal="fireball_hit" from="FireballDetection" to="ScoreNoteSpawner" method="spawn_note" binds= [500]]
  270. [connection signal="moving_shell_entered" from="ShellDetection" to="." method="die_from_object"]
  271. [connection signal="timeout" from="ThrowTimer" to="." method="throw_ball"]
  272. [connection signal="timeout" from="TurnTimer" to="." method="on_timeout"]
  273. [connection signal="explosion_entered" from="ExplosionDetection" to="." method="die_from_object"]
  274. [connection signal="explosion_entered" from="ExplosionDetection" to="ScoreNoteSpawner" method="spawn_note" binds= [500]]