Player.tscn 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. [gd_scene load_steps=19 format=3 uid="uid://bpdyvy2681m3i"]
  2. [ext_resource type="Script" path="res://player/player_controller.gd" id="1"]
  3. [ext_resource type="Script" path="res://player/player_state_machine.gd" id="2"]
  4. [ext_resource type="Script" path="res://player/states/motion/on_ground/idle.gd" id="3"]
  5. [ext_resource type="Script" path="res://player/states/motion/on_ground/move.gd" id="4"]
  6. [ext_resource type="Script" path="res://player/states/motion/in_air/jump.gd" id="5"]
  7. [ext_resource type="Script" path="res://player/states/combat/stagger.gd" id="6"]
  8. [ext_resource type="Script" path="res://player/states/combat/attack.gd" id="7"]
  9. [ext_resource type="Script" path="res://player/states/die.gd" id="8"]
  10. [ext_resource type="Texture2D" uid="uid://eds33w28pilu" path="res://player/shadow.png" id="9"]
  11. [ext_resource type="Texture2D" uid="uid://ds53oxkqrcumd" path="res://player/body.png" id="10"]
  12. [ext_resource type="Script" path="res://player/bullet/bullet_spawner.gd" id="11"]
  13. [ext_resource type="Script" path="res://player/weapon/weapon_pivot.gd" id="12"]
  14. [ext_resource type="PackedScene" uid="uid://cdacdp11r3jua" path="res://player/weapon/Sword.tscn" id="13"]
  15. [ext_resource type="Script" path="res://player/states/debug/state_name_displayer.gd" id="15"]
  16. [sub_resource type="Animation" id="1"]
  17. [sub_resource type="Animation" id="2"]
  18. length = 0.6
  19. tracks/0/type = "value"
  20. tracks/0/imported = false
  21. tracks/0/enabled = true
  22. tracks/0/path = NodePath("BodyPivot/Body:modulate")
  23. tracks/0/interp = 1
  24. tracks/0/loop_wrap = true
  25. tracks/0/keys = {
  26. "times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.4),
  27. "transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
  28. "update": 0,
  29. "values": [Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(1, 1, 1, 1)]
  30. }
  31. [sub_resource type="Animation" id="3"]
  32. [sub_resource type="AnimationLibrary" id="AnimationLibrary_vi1hn"]
  33. _data = {
  34. "idle": SubResource("1"),
  35. "stagger": SubResource("2"),
  36. "walk": SubResource("3")
  37. }
  38. [node name="Player" type="CharacterBody2D"]
  39. script = ExtResource("1")
  40. [node name="StateMachine" type="Node" parent="."]
  41. script = ExtResource("2")
  42. [node name="Idle" type="Node" parent="StateMachine"]
  43. script = ExtResource("3")
  44. [node name="Move" type="Node" parent="StateMachine"]
  45. script = ExtResource("4")
  46. [node name="Jump" type="Node" parent="StateMachine"]
  47. script = ExtResource("5")
  48. [node name="Stagger" type="Node" parent="StateMachine"]
  49. script = ExtResource("6")
  50. [node name="Attack" type="Node" parent="StateMachine"]
  51. script = ExtResource("7")
  52. [node name="Die" type="Node" parent="StateMachine"]
  53. script = ExtResource("8")
  54. [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
  55. libraries = {
  56. "": SubResource("AnimationLibrary_vi1hn")
  57. }
  58. [node name="Shadow" type="Sprite2D" parent="."]
  59. self_modulate = Color(1, 1, 1, 0.361098)
  60. position = Vector2(0, -4)
  61. texture = ExtResource("9")
  62. [node name="BodyPivot" type="Marker2D" parent="."]
  63. [node name="Body" type="Sprite2D" parent="BodyPivot"]
  64. position = Vector2(0, -58)
  65. texture = ExtResource("10")
  66. [node name="BulletSpawn" type="Node2D" parent="BodyPivot"]
  67. position = Vector2(0, -58)
  68. script = ExtResource("11")
  69. [node name="CooldownTimer" type="Timer" parent="BodyPivot/BulletSpawn"]
  70. wait_time = 0.2
  71. one_shot = true
  72. [node name="WeaponPivot" type="Marker2D" parent="BodyPivot"]
  73. position = Vector2(0, -58)
  74. script = ExtResource("12")
  75. [node name="Offset" type="Marker2D" parent="BodyPivot/WeaponPivot"]
  76. position = Vector2(110, 0)
  77. [node name="Sword" parent="BodyPivot/WeaponPivot/Offset" instance=ExtResource("13")]
  78. [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
  79. polygon = PackedVector2Array(-20, 0, -20, -20, 20, -20, 20, 0)
  80. [node name="StateNameDisplayer" type="Label" parent="."]
  81. offset_left = -109.0
  82. offset_top = -180.0
  83. offset_right = 110.0
  84. offset_bottom = -143.0
  85. theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
  86. theme_override_constants/outline_size = 8
  87. theme_override_font_sizes/font_size = 24
  88. text = "Idle"
  89. horizontal_alignment = 1
  90. uppercase = true
  91. script = ExtResource("15")
  92. [connection signal="state_changed" from="StateMachine" to="BodyPivot/WeaponPivot/Offset/Sword" method="_on_StateMachine_state_changed"]
  93. [connection signal="state_changed" from="StateMachine" to="StateNameDisplayer" method="_on_StateMachine_state_changed"]
  94. [connection signal="animation_finished" from="AnimationPlayer" to="StateMachine" method="_on_animation_finished"]
  95. [connection signal="attack_finished" from="BodyPivot/WeaponPivot/Offset/Sword" to="StateMachine/Attack" method="_on_Sword_attack_finished"]