WrenchProjectile.tscn 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. [gd_scene load_steps=14 format=3 uid="uid://p42vcj0qmhxl"]
  2. [ext_resource type="Texture2D" uid="uid://cop8x5m20cqal" path="res://Assets/Sprites/Items/WrenchProjectile.png" id="1_bh1cs"]
  3. [ext_resource type="Script" uid="uid://caq1qiwmy0mox" path="res://Scripts/Parts/BetterAnimatedSprite.gd" id="2_wtsxo"]
  4. [ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="3_7wlxe"]
  5. [ext_resource type="Script" uid="uid://cnheej0sxmoxg" path="res://Scripts/Parts/PlayerDetection.gd" id="3_tfqn5"]
  6. [ext_resource type="JSON" path="res://Assets/Sprites/Items/WrenchProjectile.json" id="4_5s4r1"]
  7. [ext_resource type="Script" uid="uid://chj8hu207lrh" path="res://Scripts/Classes/Components/EnemyPlayerDetection.gd" id="4_7wlxe"]
  8. [sub_resource type="GDScript" id="GDScript_5s4r1"]
  9. script/source = "extends Node2D
  10. var direction := -1
  11. const MOVE_SPEED := 80
  12. func _physics_process(delta: float) -> void:
  13. $Sprite.flip_h = direction == 1
  14. global_position.x += MOVE_SPEED * direction * delta
  15. func damage_player(player: Player) -> void:
  16. player.damage()
  17. "
  18. [sub_resource type="AtlasTexture" id="AtlasTexture_bn4i0"]
  19. atlas = ExtResource("1_bh1cs")
  20. region = Rect2(32, 0, 16, 16)
  21. [sub_resource type="AtlasTexture" id="AtlasTexture_ytcl6"]
  22. atlas = ExtResource("1_bh1cs")
  23. region = Rect2(0, 0, 16, 16)
  24. [sub_resource type="AtlasTexture" id="AtlasTexture_tf2mk"]
  25. atlas = ExtResource("1_bh1cs")
  26. region = Rect2(16, 0, 16, 16)
  27. [sub_resource type="AtlasTexture" id="AtlasTexture_nfd5u"]
  28. atlas = ExtResource("1_bh1cs")
  29. region = Rect2(48, 0, 16, 16)
  30. [sub_resource type="SpriteFrames" id="SpriteFrames_4d740"]
  31. animations = [{
  32. "frames": [{
  33. "duration": 1.0,
  34. "texture": SubResource("AtlasTexture_bn4i0")
  35. }],
  36. "loop": true,
  37. "name": &"Idle",
  38. "speed": 5.0
  39. }, {
  40. "frames": [{
  41. "duration": 1.0,
  42. "texture": SubResource("AtlasTexture_ytcl6")
  43. }, {
  44. "duration": 1.0,
  45. "texture": SubResource("AtlasTexture_tf2mk")
  46. }, {
  47. "duration": 1.0,
  48. "texture": SubResource("AtlasTexture_nfd5u")
  49. }],
  50. "loop": true,
  51. "name": &"Spin",
  52. "speed": 15.0
  53. }]
  54. [sub_resource type="CircleShape2D" id="CircleShape2D_srvot"]
  55. radius = 2.0
  56. [node name="WrenchProjectile" type="Node2D"]
  57. script = SubResource("GDScript_5s4r1")
  58. [node name="Sprite" type="AnimatedSprite2D" parent="."]
  59. sprite_frames = SubResource("SpriteFrames_4d740")
  60. animation = &"Spin"
  61. autoplay = "Spin"
  62. frame_progress = 0.89535326
  63. script = ExtResource("2_wtsxo")
  64. do_offset = false
  65. metadata/_custom_type_script = "uid://caq1qiwmy0mox"
  66. [node name="ResourceSetterNew" type="Node" parent="Sprite" node_paths=PackedStringArray("node_to_affect")]
  67. script = ExtResource("3_7wlxe")
  68. node_to_affect = NodePath("..")
  69. property_name = "sprite_frames"
  70. resource_json = ExtResource("4_5s4r1")
  71. metadata/_custom_type_script = "uid://cbal8ms2oe1ik"
  72. [node name="PlayerDetection" type="Area2D" parent="."]
  73. script = ExtResource("3_tfqn5")
  74. metadata/_custom_type_script = "uid://cnheej0sxmoxg"
  75. [node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerDetection"]
  76. shape = SubResource("CircleShape2D_srvot")
  77. [node name="EnemyPlayerDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
  78. script = ExtResource("4_7wlxe")
  79. hitbox = NodePath("../PlayerDetection")
  80. metadata/_custom_type_script = "uid://chj8hu207lrh"
  81. [node name="VisibleOnScreenEnabler2D" type="VisibleOnScreenEnabler2D" parent="."]
  82. [connection signal="player_hit" from="EnemyPlayerDetection" to="." method="damage_player"]
  83. [connection signal="player_stomped_on" from="EnemyPlayerDetection" to="." method="damage_player"]
  84. [connection signal="screen_exited" from="VisibleOnScreenEnabler2D" to="." method="queue_free"]