Player.tscn 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. [gd_scene load_steps=20 format=2]
  2. [ext_resource path="res://player/player_controller.gd" type="Script" id=1]
  3. [ext_resource path="res://player/player_state_machine.gd" type="Script" id=2]
  4. [ext_resource path="res://player/states/motion/on_ground/idle.gd" type="Script" id=3]
  5. [ext_resource path="res://player/states/motion/on_ground/move.gd" type="Script" id=4]
  6. [ext_resource path="res://player/states/motion/in_air/jump.gd" type="Script" id=5]
  7. [ext_resource path="res://player/states/combat/stagger.gd" type="Script" id=6]
  8. [ext_resource path="res://player/states/combat/attack.gd" type="Script" id=7]
  9. [ext_resource path="res://player/states/die.gd" type="Script" id=8]
  10. [ext_resource path="res://player/shadow.png" type="Texture" id=9]
  11. [ext_resource path="res://player/body.png" type="Texture" id=10]
  12. [ext_resource path="res://player/bullet/bullet_spawner.gd" type="Script" id=11]
  13. [ext_resource path="res://player/weapon/weapon_pivot.gd" type="Script" id=12]
  14. [ext_resource path="res://player/weapon/Sword.tscn" type="PackedScene" id=13]
  15. [ext_resource path="res://fonts/SourceCodePro-Bold.ttf" type="DynamicFontData" id=14]
  16. [ext_resource path="res://player/states/debug/state_name_displayer.gd" type="Script" id=15]
  17. [sub_resource type="Animation" id=1]
  18. length = 1.0
  19. loop = false
  20. step = 0.1
  21. [sub_resource type="Animation" id=2]
  22. length = 0.6
  23. loop = false
  24. step = 0.1
  25. tracks/0/type = "value"
  26. tracks/0/path = NodePath("BodyPivot/Body:modulate")
  27. tracks/0/interp = 1
  28. tracks/0/loop_wrap = true
  29. tracks/0/imported = false
  30. tracks/0/enabled = true
  31. tracks/0/keys = {
  32. "times": PoolRealArray( 0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.4 ),
  33. "transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1 ),
  34. "update": 0,
  35. "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 ) ]
  36. }
  37. [sub_resource type="Animation" id=3]
  38. length = 1.0
  39. loop = false
  40. step = 0.1
  41. [sub_resource type="DynamicFont" id=4]
  42. size = 20
  43. use_mipmaps = false
  44. use_filter = true
  45. font_data = ExtResource( 14 )
  46. _sections_unfolded = [ "Font", "Settings" ]
  47. [node name="Player" type="KinematicBody2D" index="0"]
  48. position = Vector2( 628.826, 391.266 )
  49. input_pickable = false
  50. collision_layer = 1
  51. collision_mask = 1
  52. collision/safe_margin = 0.08
  53. script = ExtResource( 1 )
  54. _sections_unfolded = [ "Visibility" ]
  55. __meta__ = {
  56. "_edit_horizontal_guides_": [ ]
  57. }
  58. [node name="StateMachine" type="Node" parent="." index="0"]
  59. script = ExtResource( 2 )
  60. START_STATE = NodePath("Idle")
  61. [node name="Idle" type="Node" parent="StateMachine" index="0"]
  62. script = ExtResource( 3 )
  63. [node name="Move" type="Node" parent="StateMachine" index="1"]
  64. script = ExtResource( 4 )
  65. MAX_WALK_SPEED = 450
  66. MAX_RUN_SPEED = 700
  67. [node name="Jump" type="Node" parent="StateMachine" index="2"]
  68. script = ExtResource( 5 )
  69. BASE_MAX_HORIZONTAL_SPEED = 400.0
  70. AIR_ACCELERATION = 1000.0
  71. AIR_DECCELERATION = 2000.0
  72. AIR_STEERING_POWER = 50.0
  73. JUMP_HEIGHT = 120.0
  74. JUMP_DURATION = 0.8
  75. GRAVITY = 1600.0
  76. [node name="Stagger" type="Node" parent="StateMachine" index="3"]
  77. script = ExtResource( 6 )
  78. [node name="Attack" type="Node" parent="StateMachine" index="4"]
  79. script = ExtResource( 7 )
  80. [node name="Die" type="Node" parent="StateMachine" index="5"]
  81. script = ExtResource( 8 )
  82. [node name="AnimationPlayer" type="AnimationPlayer" parent="." index="1"]
  83. root_node = NodePath("..")
  84. autoplay = ""
  85. playback_process_mode = 1
  86. playback_default_blend_time = 0.0
  87. playback_speed = 1.0
  88. anims/idle = SubResource( 1 )
  89. anims/stagger = SubResource( 2 )
  90. anims/walk = SubResource( 3 )
  91. blend_times = [ ]
  92. [node name="Shadow" type="Sprite" parent="." index="2"]
  93. self_modulate = Color( 1, 1, 1, 0.361098 )
  94. position = Vector2( 0, -4 )
  95. texture = ExtResource( 9 )
  96. _sections_unfolded = [ "Visibility" ]
  97. [node name="BodyPivot" type="Position2D" parent="." index="3"]
  98. [node name="Body" type="Sprite" parent="BodyPivot" index="0"]
  99. position = Vector2( 0, -58.8242 )
  100. texture = ExtResource( 10 )
  101. [node name="BulletSpawn" type="Node2D" parent="BodyPivot" index="1"]
  102. editor/display_folded = true
  103. position = Vector2( 1.17401, -61.266 )
  104. script = ExtResource( 11 )
  105. _sections_unfolded = [ "Transform" ]
  106. [node name="CooldownTimer" type="Timer" parent="BodyPivot/BulletSpawn" index="0"]
  107. process_mode = 1
  108. wait_time = 0.2
  109. one_shot = true
  110. autostart = false
  111. [node name="WeaponPivot" type="Position2D" parent="BodyPivot" index="2"]
  112. position = Vector2( 1.17401, -61.266 )
  113. script = ExtResource( 12 )
  114. [node name="Offset" type="Position2D" parent="BodyPivot/WeaponPivot" index="0"]
  115. position = Vector2( 110, 0 )
  116. [node name="Sword" parent="BodyPivot/WeaponPivot/Offset" index="0" instance=ExtResource( 13 )]
  117. [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="." index="4"]
  118. build_mode = 0
  119. polygon = PoolVector2Array( -20, 0, -20, -20, 20, -20, 20, 0 )
  120. [node name="StateNameDisplayer" type="Label" parent="." index="5"]
  121. editor/display_folded = true
  122. anchor_left = 0.0
  123. anchor_top = 0.0
  124. anchor_right = 0.0
  125. anchor_bottom = 0.0
  126. margin_left = -109.0
  127. margin_top = -172.0
  128. margin_right = 110.0
  129. margin_bottom = -138.0
  130. rect_pivot_offset = Vector2( 0, 0 )
  131. rect_clip_content = false
  132. mouse_filter = 2
  133. mouse_default_cursor_shape = 0
  134. size_flags_horizontal = 1
  135. size_flags_vertical = 4
  136. custom_fonts/font = SubResource( 4 )
  137. text = "Test"
  138. align = 1
  139. valign = 1
  140. uppercase = true
  141. percent_visible = 1.0
  142. lines_skipped = 0
  143. max_lines_visible = -1
  144. script = ExtResource( 15 )
  145. _sections_unfolded = [ "Rect", "custom_fonts" ]
  146. [connection signal="state_changed" from="StateMachine" to="BodyPivot/WeaponPivot/Offset/Sword" method="_on_StateMachine_state_changed"]
  147. [connection signal="state_changed" from="StateMachine" to="StateNameDisplayer" method="_on_StateMachine_state_changed"]
  148. [connection signal="animation_finished" from="AnimationPlayer" to="StateMachine" method="_on_animation_finished"]
  149. [connection signal="attack_finished" from="BodyPivot/WeaponPivot/Offset/Sword" to="StateMachine/Attack" method="_on_Sword_attack_finished"]