HammerBro.tscn 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. [gd_scene load_steps=36 format=3 uid="uid://kr7i2kf6rew0"]
  2. [ext_resource type="Script" uid="uid://b8gdlotx0at6x" path="res://Scripts/Classes/Entities/Enemies/HammerBro.gd" id="1_8mo24"]
  3. [ext_resource type="Texture2D" uid="uid://l3l3icupve4t" path="res://Assets/Sprites/Enemies/HammerBro.png" id="2_8mo24"]
  4. [ext_resource type="Texture2D" uid="uid://3xmhfi556p3s" path="res://Assets/Sprites/Items/Hammer.png" id="3_dywvb"]
  5. [ext_resource type="Script" uid="uid://caq1qiwmy0mox" path="res://Scripts/Parts/BetterAnimatedSprite.gd" id="3_hx42c"]
  6. [ext_resource type="Script" uid="uid://chj8hu207lrh" path="res://Scripts/Classes/Components/EnemyPlayerDetection.gd" id="5_i0wjw"]
  7. [ext_resource type="JSON" path="res://Assets/Sprites/Items/Hammer.json" id="6_0w8yj"]
  8. [ext_resource type="Script" uid="uid://cmg61722ktg2m" path="res://Scripts/Classes/Components/BlockBouncingDetection.gd" id="6_1mp8k"]
  9. [ext_resource type="Script" uid="uid://cmvlgsjmsk0v5" path="res://Scripts/Classes/Resources/ThemedResource.gd" id="6_hx42c"]
  10. [ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="7_pvn5i"]
  11. [ext_resource type="Script" uid="uid://dri2d5jtu0fbq" path="res://Scripts/Classes/Components/FireballDetection.gd" id="7_scjjh"]
  12. [ext_resource type="JSON" path="res://Assets/Sprites/Enemies/HammerBro.json" id="8_0w8yj"]
  13. [ext_resource type="Script" uid="uid://c3gg32ivrlq8n" path="res://Scripts/Classes/Components/GibSpawner.gd" id="8_1mp8k"]
  14. [ext_resource type="Script" uid="uid://5octqlf4ohel" path="res://Scripts/Classes/Components/ScoreNoteSpawner.gd" id="9_scjjh"]
  15. [ext_resource type="Script" uid="uid://bbww34oiexbx2" path="res://Scripts/Classes/Components/ShellDetection.gd" id="12_hx42c"]
  16. [ext_resource type="Script" uid="uid://cqif1li7otvpl" path="res://Scripts/Parts/SpriteFramesToJsonConverter.gd" id="15_2r2js"]
  17. [ext_resource type="Script" uid="uid://ba18grqjixded" path="res://Scripts/Classes/Components/ExplosionDetection.gd" id="16_0w8yj"]
  18. [ext_resource type="Script" uid="uid://d4a7yp6e55u8t" path="res://Scripts/Classes/Components/TrackJoint.gd" id="17_2r2js"]
  19. [sub_resource type="AtlasTexture" id="AtlasTexture_pvn5i"]
  20. atlas = ExtResource("2_8mo24")
  21. region = Rect2(32, 0, 16, 24)
  22. [sub_resource type="AtlasTexture" id="AtlasTexture_0w8yj"]
  23. atlas = ExtResource("2_8mo24")
  24. region = Rect2(48, 0, 16, 24)
  25. [sub_resource type="AtlasTexture" id="AtlasTexture_2r2js"]
  26. atlas = ExtResource("2_8mo24")
  27. region = Rect2(0, 0, 16, 24)
  28. [sub_resource type="AtlasTexture" id="AtlasTexture_dq4jl"]
  29. atlas = ExtResource("2_8mo24")
  30. region = Rect2(16, 0, 16, 24)
  31. [sub_resource type="SpriteFrames" id="SpriteFrames_cl1av"]
  32. animations = [{
  33. "frames": [{
  34. "duration": 1.0,
  35. "texture": SubResource("AtlasTexture_pvn5i")
  36. }, {
  37. "duration": 1.0,
  38. "texture": SubResource("AtlasTexture_0w8yj")
  39. }],
  40. "loop": true,
  41. "name": &"Hammer",
  42. "speed": 5.0
  43. }, {
  44. "frames": [{
  45. "duration": 1.0,
  46. "texture": SubResource("AtlasTexture_2r2js")
  47. }, {
  48. "duration": 1.0,
  49. "texture": SubResource("AtlasTexture_dq4jl")
  50. }],
  51. "loop": true,
  52. "name": &"Idle",
  53. "speed": 5.0
  54. }]
  55. [sub_resource type="AtlasTexture" id="AtlasTexture_hx42c"]
  56. atlas = ExtResource("3_dywvb")
  57. region = Rect2(0, 0, 16, 16)
  58. [sub_resource type="Animation" id="Animation_1mp8k"]
  59. resource_name = "Movement"
  60. loop_mode = 2
  61. tracks/0/type = "value"
  62. tracks/0/imported = false
  63. tracks/0/enabled = true
  64. tracks/0/path = NodePath("Sprite:position")
  65. tracks/0/interp = 1
  66. tracks/0/loop_wrap = true
  67. tracks/0/keys = {
  68. "times": PackedFloat32Array(0, 1),
  69. "transitions": PackedFloat32Array(1, 1),
  70. "update": 0,
  71. "values": [Vector2(8, -12), Vector2(-8, -12)]
  72. }
  73. [sub_resource type="Animation" id="Animation_scjjh"]
  74. length = 0.001
  75. tracks/0/type = "value"
  76. tracks/0/imported = false
  77. tracks/0/enabled = true
  78. tracks/0/path = NodePath("Sprite:position")
  79. tracks/0/interp = 1
  80. tracks/0/loop_wrap = true
  81. tracks/0/keys = {
  82. "times": PackedFloat32Array(0),
  83. "transitions": PackedFloat32Array(1),
  84. "update": 0,
  85. "values": [Vector2(0, -12)]
  86. }
  87. [sub_resource type="AnimationLibrary" id="AnimationLibrary_2vqj5"]
  88. _data = {
  89. &"Movement": SubResource("Animation_1mp8k"),
  90. &"RESET": SubResource("Animation_scjjh")
  91. }
  92. [sub_resource type="RectangleShape2D" id="RectangleShape2D_dywvb"]
  93. size = Vector2(8, 16)
  94. [sub_resource type="RectangleShape2D" id="RectangleShape2D_2vqj5"]
  95. size = Vector2(12, 16)
  96. [sub_resource type="AtlasTexture" id="AtlasTexture_eel5y"]
  97. atlas = ExtResource("2_8mo24")
  98. region = Rect2(32, 24, 16, 24)
  99. [sub_resource type="AtlasTexture" id="AtlasTexture_cl1av"]
  100. atlas = ExtResource("2_8mo24")
  101. region = Rect2(48, 24, 16, 24)
  102. [sub_resource type="AtlasTexture" id="AtlasTexture_ccgvu"]
  103. atlas = ExtResource("2_8mo24")
  104. region = Rect2(0, 24, 16, 24)
  105. [sub_resource type="AtlasTexture" id="AtlasTexture_2u435"]
  106. atlas = ExtResource("2_8mo24")
  107. region = Rect2(16, 24, 16, 24)
  108. [sub_resource type="SpriteFrames" id="SpriteFrames_6r0gb"]
  109. animations = [{
  110. "frames": [{
  111. "duration": 1.0,
  112. "texture": SubResource("AtlasTexture_eel5y")
  113. }, {
  114. "duration": 1.0,
  115. "texture": SubResource("AtlasTexture_cl1av")
  116. }],
  117. "loop": true,
  118. "name": &"Hammer",
  119. "speed": 5.0
  120. }, {
  121. "frames": [{
  122. "duration": 1.0,
  123. "texture": SubResource("AtlasTexture_ccgvu")
  124. }, {
  125. "duration": 1.0,
  126. "texture": SubResource("AtlasTexture_2u435")
  127. }],
  128. "loop": true,
  129. "name": &"Idle",
  130. "speed": 5.0
  131. }]
  132. [sub_resource type="SpriteFrames" id="SpriteFrames_5o1ie"]
  133. animations = [{
  134. "frames": [{
  135. "duration": 1.0,
  136. "texture": SubResource("AtlasTexture_eel5y")
  137. }, {
  138. "duration": 1.0,
  139. "texture": SubResource("AtlasTexture_cl1av")
  140. }],
  141. "loop": true,
  142. "name": &"Hammer",
  143. "speed": 5.0
  144. }, {
  145. "frames": [{
  146. "duration": 1.0,
  147. "texture": SubResource("AtlasTexture_ccgvu")
  148. }, {
  149. "duration": 1.0,
  150. "texture": SubResource("AtlasTexture_2u435")
  151. }],
  152. "loop": true,
  153. "name": &"Idle",
  154. "speed": 5.0
  155. }]
  156. [sub_resource type="Resource" id="Resource_pvn5i"]
  157. script = ExtResource("6_hx42c")
  158. Overworld = SubResource("SpriteFrames_cl1av")
  159. Underground = SubResource("SpriteFrames_5o1ie")
  160. Castle = SubResource("SpriteFrames_6r0gb")
  161. metadata/_custom_type_script = ExtResource("6_hx42c")
  162. [node name="HammerBro" type="CharacterBody2D" node_paths=PackedStringArray("on_screen_enabler", "score_note_adder") groups=["Enemies"]]
  163. collision_layer = 16
  164. collision_mask = 2
  165. script = ExtResource("1_8mo24")
  166. on_screen_enabler = NodePath("VisibleOnScreenEnabler2D")
  167. score_note_adder = NodePath("ScoreNoteSpawner")
  168. metadata/_custom_type_script = "uid://bpydbpyjk1mt4"
  169. [node name="Sprite" type="AnimatedSprite2D" parent="."]
  170. position = Vector2(0, -12)
  171. scale = Vector2(-1, 1)
  172. sprite_frames = SubResource("SpriteFrames_cl1av")
  173. animation = &"Idle"
  174. frame_progress = 0.755197
  175. offset = Vector2(2, 0)
  176. flip_h = true
  177. script = ExtResource("3_hx42c")
  178. metadata/_custom_type_script = "uid://caq1qiwmy0mox"
  179. [node name="Hammer" type="Sprite2D" parent="Sprite"]
  180. visible = false
  181. show_behind_parent = true
  182. position = Vector2(0, -17)
  183. texture = SubResource("AtlasTexture_hx42c")
  184. flip_h = true
  185. [node name="ResourceSetterNew" type="Node" parent="Sprite/Hammer" node_paths=PackedStringArray("node_to_affect")]
  186. script = ExtResource("7_pvn5i")
  187. node_to_affect = NodePath("..")
  188. property_name = "texture"
  189. mode = 1
  190. resource_json = ExtResource("6_0w8yj")
  191. metadata/_custom_type_script = "uid://cbal8ms2oe1ik"
  192. [node name="ResourceSetterNew" type="Node" parent="Sprite" node_paths=PackedStringArray("node_to_affect")]
  193. script = ExtResource("7_pvn5i")
  194. node_to_affect = NodePath("..")
  195. property_name = "sprite_frames"
  196. resource_json = ExtResource("8_0w8yj")
  197. metadata/_custom_type_script = "uid://cbal8ms2oe1ik"
  198. [node name="MovementAnimations" type="AnimationPlayer" parent="."]
  199. libraries = {
  200. &"": SubResource("AnimationLibrary_2vqj5")
  201. }
  202. [node name="Collision" type="CollisionShape2D" parent="."]
  203. visible = false
  204. position = Vector2(0, -8)
  205. shape = SubResource("RectangleShape2D_dywvb")
  206. [node name="BlockDetect" type="RayCast2D" parent="."]
  207. position = Vector2(0, 17)
  208. target_position = Vector2(0, 24)
  209. collision_mask = 2
  210. hit_from_inside = true
  211. [node name="UpBlock" type="RayCast2D" parent="."]
  212. visible = false
  213. position = Vector2(0, -32)
  214. target_position = Vector2(0, -24)
  215. collision_mask = 2
  216. hit_from_inside = true
  217. [node name="JumpTimer" type="Timer" parent="."]
  218. wait_time = 4.0
  219. one_shot = true
  220. [node name="HammerTimer" type="Timer" parent="."]
  221. one_shot = true
  222. [node name="EnemyPlayerDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
  223. script = ExtResource("5_i0wjw")
  224. hitbox = NodePath("../Hitbox")
  225. metadata/_custom_type_script = "uid://chj8hu207lrh"
  226. [node name="Hitbox" type="Area2D" parent="."]
  227. [node name="Shape" type="CollisionShape2D" parent="Hitbox"]
  228. visible = false
  229. position = Vector2(0, -8)
  230. shape = SubResource("RectangleShape2D_2vqj5")
  231. [node name="BlockBouncingDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
  232. script = ExtResource("6_1mp8k")
  233. hitbox = NodePath("../Hitbox")
  234. metadata/_custom_type_script = "uid://cmg61722ktg2m"
  235. [node name="FireballDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
  236. script = ExtResource("7_scjjh")
  237. hitbox = NodePath("../Hitbox")
  238. metadata/_custom_type_script = "uid://dri2d5jtu0fbq"
  239. [node name="GibSpawner" type="Node" parent="." node_paths=PackedStringArray("visuals")]
  240. script = ExtResource("8_1mp8k")
  241. visuals = NodePath("../Sprite")
  242. metadata/_custom_type_script = "uid://c3gg32ivrlq8n"
  243. [node name="VisibleOnScreenEnabler2D" type="VisibleOnScreenEnabler2D" parent="."]
  244. self_modulate = Color(1, 1, 1, 0)
  245. position = Vector2(0, -15)
  246. scale = Vector2(1, 1.7)
  247. [node name="ScoreNoteSpawner" type="Node" parent="."]
  248. script = ExtResource("9_scjjh")
  249. add_score = true
  250. metadata/_custom_type_script = "uid://5octqlf4ohel"
  251. [node name="Timer" type="Timer" parent="."]
  252. wait_time = 10.0
  253. one_shot = true
  254. [node name="ShellDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
  255. script = ExtResource("12_hx42c")
  256. hitbox = NodePath("../Hitbox")
  257. metadata/_custom_type_script = "uid://bbww34oiexbx2"
  258. [node name="ThemedToJSONConverter" type="Node" parent="."]
  259. script = ExtResource("15_2r2js")
  260. resource = SubResource("Resource_pvn5i")
  261. json_file_path = "res://Assets/Sprites/Enemies/HammerBro.json"
  262. metadata/_custom_type_script = "uid://cqif1li7otvpl"
  263. [node name="ExplosionDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
  264. script = ExtResource("16_0w8yj")
  265. hitbox = NodePath("../Hitbox")
  266. [node name="TrackJoint" type="Node" parent="."]
  267. script = ExtResource("17_2r2js")
  268. metadata/_custom_type_script = "uid://d4a7yp6e55u8t"
  269. [connection signal="killed" from="." to="GibSpawner" method="summon_gib"]
  270. [connection signal="timeout" from="JumpTimer" to="." method="jump" binds= [false]]
  271. [connection signal="timeout" from="HammerTimer" to="." method="do_hammer_throw"]
  272. [connection signal="invincible_player_hit" from="EnemyPlayerDetection" to="." method="die_from_object"]
  273. [connection signal="invincible_player_hit" from="EnemyPlayerDetection" to="ScoreNoteSpawner" method="spawn_note" binds= [1000]]
  274. [connection signal="player_hit" from="EnemyPlayerDetection" to="." method="damage_player"]
  275. [connection signal="player_stomped_on" from="EnemyPlayerDetection" to="GibSpawner" method="stomp_die" binds= [false]]
  276. [connection signal="player_stomped_on" from="EnemyPlayerDetection" to="ScoreNoteSpawner" method="spawn_note" binds= [1000]]
  277. [connection signal="block_bounced" from="BlockBouncingDetection" to="." method="die_from_object"]
  278. [connection signal="block_bounced" from="BlockBouncingDetection" to="ScoreNoteSpawner" method="spawn_note" binds= [1000]]
  279. [connection signal="fireball_hit" from="FireballDetection" to="." method="die_from_object"]
  280. [connection signal="fireball_hit" from="FireballDetection" to="ScoreNoteSpawner" method="spawn_note" binds= [1000]]
  281. [connection signal="gib_about_to_spawn" from="GibSpawner" to="Sprite/Hammer" method="hide"]
  282. [connection signal="screen_entered" from="VisibleOnScreenEnabler2D" to="." method="on_screen_entered"]
  283. [connection signal="timeout" from="Timer" to="." method="charge"]
  284. [connection signal="moving_shell_entered" from="ShellDetection" to="." method="die_from_object"]
  285. [connection signal="explosion_entered" from="ExplosionDetection" to="." method="die_from_object"]
  286. [connection signal="explosion_entered" from="ExplosionDetection" to="ScoreNoteSpawner" method="spawn_note" binds= [1000]]
  287. [connection signal="attached" from="TrackJoint" to="MovementAnimations" method="play" binds= ["RESET"]]