enemy.tscn 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. [gd_scene load_steps=15 format=3 uid="uid://6mtip3ruyn"]
  2. [ext_resource type="Texture2D" uid="uid://coj0d33vyyqx1" path="res://player/bullet.webp" id="1"]
  3. [ext_resource type="AudioStream" uid="uid://duwm7i44o75o2" path="res://enemy/explode.wav" id="2"]
  4. [ext_resource type="AudioStream" uid="uid://dm7wsawmylc7b" path="res://enemy/hit.wav" id="3"]
  5. [ext_resource type="Texture2D" uid="uid://bjjywmvba0sve" path="res://enemy/enemy.webp" id="4"]
  6. [ext_resource type="Script" path="res://enemy/enemy.gd" id="5"]
  7. [sub_resource type="CanvasItemMaterial" id="1"]
  8. [sub_resource type="Animation" id="8"]
  9. length = 0.001
  10. tracks/0/type = "value"
  11. tracks/0/imported = false
  12. tracks/0/enabled = true
  13. tracks/0/path = NodePath("Explosion:scale_amount")
  14. tracks/0/interp = 1
  15. tracks/0/loop_wrap = true
  16. tracks/0/keys = {
  17. "times": PackedFloat32Array(0),
  18. "transitions": PackedFloat32Array(1),
  19. "update": 0,
  20. "values": [4.0]
  21. }
  22. tracks/1/type = "value"
  23. tracks/1/imported = false
  24. tracks/1/enabled = true
  25. tracks/1/path = NodePath("Sprite2D:frame")
  26. tracks/1/interp = 1
  27. tracks/1/loop_wrap = true
  28. tracks/1/keys = {
  29. "times": PackedFloat32Array(0),
  30. "transitions": PackedFloat32Array(1),
  31. "update": 0,
  32. "values": [0]
  33. }
  34. tracks/2/type = "value"
  35. tracks/2/imported = false
  36. tracks/2/enabled = true
  37. tracks/2/path = NodePath("Explosion:scale_amount_max")
  38. tracks/2/interp = 1
  39. tracks/2/loop_wrap = true
  40. tracks/2/keys = {
  41. "times": PackedFloat32Array(0),
  42. "transitions": PackedFloat32Array(1),
  43. "update": 0,
  44. "values": [1.0]
  45. }
  46. tracks/3/type = "value"
  47. tracks/3/imported = false
  48. tracks/3/enabled = true
  49. tracks/3/path = NodePath(".:collision_layer")
  50. tracks/3/interp = 1
  51. tracks/3/loop_wrap = true
  52. tracks/3/keys = {
  53. "times": PackedFloat32Array(0),
  54. "transitions": PackedFloat32Array(1),
  55. "update": 1,
  56. "values": [2]
  57. }
  58. [sub_resource type="Animation" id="2"]
  59. resource_name = "destroy"
  60. length = 1.5
  61. tracks/0/type = "value"
  62. tracks/0/imported = false
  63. tracks/0/enabled = true
  64. tracks/0/path = NodePath("Sprite2D:frame")
  65. tracks/0/interp = 1
  66. tracks/0/loop_wrap = true
  67. tracks/0/keys = {
  68. "times": PackedFloat32Array(0),
  69. "transitions": PackedFloat32Array(1),
  70. "update": 0,
  71. "values": [7]
  72. }
  73. tracks/1/type = "value"
  74. tracks/1/imported = false
  75. tracks/1/enabled = true
  76. tracks/1/path = NodePath("Sprite2D:rotation_degrees")
  77. tracks/1/interp = 1
  78. tracks/1/loop_wrap = true
  79. tracks/1/keys = {
  80. "times": PackedFloat32Array(0, 0.8),
  81. "transitions": PackedFloat32Array(0.0796601, 1),
  82. "update": 0,
  83. "values": [0.0, 180.0]
  84. }
  85. tracks/2/type = "value"
  86. tracks/2/imported = false
  87. tracks/2/enabled = true
  88. tracks/2/path = NodePath("Sprite2D:self_modulate")
  89. tracks/2/interp = 1
  90. tracks/2/loop_wrap = true
  91. tracks/2/keys = {
  92. "times": PackedFloat32Array(0, 0.5, 1.1),
  93. "transitions": PackedFloat32Array(1, 1, 1),
  94. "update": 0,
  95. "values": [Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
  96. }
  97. tracks/3/type = "value"
  98. tracks/3/imported = false
  99. tracks/3/enabled = true
  100. tracks/3/path = NodePath("Explosion:emitting")
  101. tracks/3/interp = 1
  102. tracks/3/loop_wrap = true
  103. tracks/3/keys = {
  104. "times": PackedFloat32Array(0, 0.6),
  105. "transitions": PackedFloat32Array(1, 1),
  106. "update": 1,
  107. "values": [false, true]
  108. }
  109. tracks/4/type = "value"
  110. tracks/4/imported = false
  111. tracks/4/enabled = true
  112. tracks/4/path = NodePath("Hit:playing")
  113. tracks/4/interp = 1
  114. tracks/4/loop_wrap = true
  115. tracks/4/keys = {
  116. "times": PackedFloat32Array(0.00999999),
  117. "transitions": PackedFloat32Array(1),
  118. "update": 1,
  119. "values": [true]
  120. }
  121. tracks/5/type = "value"
  122. tracks/5/imported = false
  123. tracks/5/enabled = true
  124. tracks/5/path = NodePath("Explode:playing")
  125. tracks/5/interp = 1
  126. tracks/5/loop_wrap = true
  127. tracks/5/keys = {
  128. "times": PackedFloat32Array(0.6),
  129. "transitions": PackedFloat32Array(1),
  130. "update": 1,
  131. "values": [true]
  132. }
  133. tracks/6/type = "method"
  134. tracks/6/imported = false
  135. tracks/6/enabled = true
  136. tracks/6/path = NodePath(".")
  137. tracks/6/interp = 1
  138. tracks/6/loop_wrap = true
  139. tracks/6/keys = {
  140. "times": PackedFloat32Array(1.5),
  141. "transitions": PackedFloat32Array(1),
  142. "values": [{
  143. "args": [],
  144. "method": &"queue_free"
  145. }]
  146. }
  147. tracks/7/type = "value"
  148. tracks/7/imported = false
  149. tracks/7/enabled = true
  150. tracks/7/path = NodePath(".:collision_layer")
  151. tracks/7/interp = 1
  152. tracks/7/loop_wrap = true
  153. tracks/7/keys = {
  154. "times": PackedFloat32Array(0),
  155. "transitions": PackedFloat32Array(1),
  156. "update": 1,
  157. "values": [0]
  158. }
  159. tracks/8/type = "value"
  160. tracks/8/imported = false
  161. tracks/8/enabled = true
  162. tracks/8/path = NodePath("Sprite2D:position")
  163. tracks/8/interp = 1
  164. tracks/8/loop_wrap = true
  165. tracks/8/keys = {
  166. "times": PackedFloat32Array(0, 0.2, 0.4),
  167. "transitions": PackedFloat32Array(2.2974, 0.183011, 1),
  168. "update": 0,
  169. "values": [Vector2(0, 0), Vector2(0, -32), Vector2(0, 0)]
  170. }
  171. tracks/9/type = "value"
  172. tracks/9/imported = false
  173. tracks/9/enabled = true
  174. tracks/9/path = NodePath("Explosion:scale_amount_min")
  175. tracks/9/interp = 1
  176. tracks/9/loop_wrap = true
  177. tracks/9/keys = {
  178. "times": PackedFloat32Array(0.6, 1),
  179. "transitions": PackedFloat32Array(1, 1),
  180. "update": 0,
  181. "values": [1.0, 4.0]
  182. }
  183. tracks/10/type = "value"
  184. tracks/10/imported = false
  185. tracks/10/enabled = true
  186. tracks/10/path = NodePath("Explosion:scale_amount_max")
  187. tracks/10/interp = 1
  188. tracks/10/loop_wrap = true
  189. tracks/10/keys = {
  190. "times": PackedFloat32Array(0.6, 1),
  191. "transitions": PackedFloat32Array(1, 1),
  192. "update": 0,
  193. "values": [1.0, 4.0]
  194. }
  195. [sub_resource type="Animation" id="3"]
  196. length = 3.0
  197. loop_mode = 1
  198. step = 0.25
  199. tracks/0/type = "value"
  200. tracks/0/imported = false
  201. tracks/0/enabled = true
  202. tracks/0/path = NodePath("Sprite2D:frame")
  203. tracks/0/interp = 1
  204. tracks/0/loop_wrap = true
  205. tracks/0/keys = {
  206. "times": PackedFloat32Array(0, 0.333, 0.666, 0.999, 1.332, 1.665, 1.998, 2.331, 2.664, 2.997),
  207. "transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
  208. "update": 1,
  209. "values": [5, 6, 5, 6, 5, 6, 7, 6, 7, 5]
  210. }
  211. [sub_resource type="Animation" id="4"]
  212. loop_mode = 1
  213. tracks/0/type = "value"
  214. tracks/0/imported = false
  215. tracks/0/enabled = true
  216. tracks/0/path = NodePath("Sprite2D:frame")
  217. tracks/0/interp = 1
  218. tracks/0/loop_wrap = true
  219. tracks/0/keys = {
  220. "times": PackedFloat32Array(0, 0.062475, 0.12495, 0.187425, 0.2499, 0.312375, 0.37485, 0.437325, 0.4998, 0.562275, 0.62475, 0.687225, 0.7497, 0.812175, 0.87465, 0.937125),
  221. "transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
  222. "update": 1,
  223. "values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
  224. }
  225. [sub_resource type="AnimationLibrary" id="AnimationLibrary_0kjfc"]
  226. _data = {
  227. "RESET": SubResource("8"),
  228. "destroy": SubResource("2"),
  229. "idle": SubResource("3"),
  230. "walk": SubResource("4")
  231. }
  232. [sub_resource type="CapsuleShape2D" id="5"]
  233. radius = 18.0
  234. height = 50.0
  235. [sub_resource type="CanvasItemMaterial" id="6"]
  236. blend_mode = 1
  237. [sub_resource type="Gradient" id="7"]
  238. offsets = PackedFloat32Array(0.5, 1)
  239. colors = PackedColorArray(1, 1, 1, 1, 0, 0, 0, 1)
  240. [node name="Enemy" type="CharacterBody2D"]
  241. collision_layer = 2
  242. collision_mask = 24
  243. script = ExtResource("5")
  244. [node name="PlatformDetector" type="RayCast2D" parent="."]
  245. position = Vector2(0, 6)
  246. target_position = Vector2(0, 8)
  247. collision_mask = 8
  248. [node name="FloorDetectorLeft" type="RayCast2D" parent="."]
  249. position = Vector2(-15, -4)
  250. target_position = Vector2(0, 35)
  251. collision_mask = 24
  252. [node name="FloorDetectorRight" type="RayCast2D" parent="."]
  253. position = Vector2(15.5, -3)
  254. target_position = Vector2(0, 35)
  255. collision_mask = 24
  256. [node name="Sprite2D" type="Sprite2D" parent="."]
  257. material = SubResource("1")
  258. scale = Vector2(0.8, 0.8)
  259. texture = ExtResource("4")
  260. flip_h = true
  261. hframes = 8
  262. vframes = 2
  263. [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
  264. libraries = {
  265. "": SubResource("AnimationLibrary_0kjfc")
  266. }
  267. [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
  268. rotation = -1.5708
  269. shape = SubResource("5")
  270. [node name="Explosion" type="CPUParticles2D" parent="."]
  271. self_modulate = Color(1, 1, 1, 0.12)
  272. material = SubResource("6")
  273. emitting = false
  274. amount = 32
  275. lifetime = 0.5
  276. one_shot = true
  277. speed_scale = 1.2
  278. explosiveness = 0.7
  279. draw_order = 215832976
  280. texture = ExtResource("1")
  281. emission_shape = 1
  282. emission_sphere_radius = 16.0
  283. spread = 180.0
  284. gravity = Vector2(0, -250)
  285. color_ramp = SubResource("7")
  286. [node name="Hit" type="AudioStreamPlayer2D" parent="."]
  287. stream = ExtResource("3")
  288. [node name="Explode" type="AudioStreamPlayer2D" parent="."]
  289. stream = ExtResource("2")