ship.tscn 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. [gd_scene load_steps=12 format=1]
  2. [ext_resource path="res://rail.gd" type="Script" id=1]
  3. [ext_resource path="res://ship.gd" type="Script" id=2]
  4. [ext_resource path="res://ship.png" type="Texture" id=3]
  5. [ext_resource path="res://fire.png" type="Texture" id=4]
  6. [ext_resource path="res://explosion.tscn" type="PackedScene" id=5]
  7. [ext_resource path="res://sound_shoot.wav" type="Sample" id=6]
  8. [ext_resource path="res://sound_explode.wav" type="Sample" id=7]
  9. [sub_resource type="ConvexPolygonShape2D" id=1]
  10. custom_solver_bias = 0.0
  11. points = Vector2Array( 25.9104, 1.3603, -20.5637, 14.8656, -20.5637, -15.3227 )
  12. [sub_resource type="ColorRamp" id=2]
  13. offsets = FloatArray( 0, 0.474062, 0.653631, 1 )
  14. colors = ColorArray( 0.154794, 0.413313, 0.991004, 1, 0.555474, 0.971578, 0, 1, 0.82934, 0.989088, 0.616085, 0.383915, 1, 1, 1, 0 )
  15. [sub_resource type="Animation" id=3]
  16. length = 1.0
  17. loop = false
  18. step = 0.1
  19. tracks/0/type = "value"
  20. tracks/0/path = NodePath("sprite:visibility/visible")
  21. tracks/0/interp = 1
  22. tracks/0/keys = { "cont":false, "times":FloatArray( 0, 0.1 ), "transitions":FloatArray( 1, 1 ), "values":[ true, false ] }
  23. tracks/1/type = "value"
  24. tracks/1/path = NodePath("thruster:config/emitting")
  25. tracks/1/interp = 1
  26. tracks/1/keys = { "cont":false, "times":FloatArray( 0 ), "transitions":FloatArray( 1 ), "values":[ false ] }
  27. tracks/2/type = "value"
  28. tracks/2/path = NodePath("explosion:config/emitting")
  29. tracks/2/interp = 1
  30. tracks/2/keys = { "cont":false, "times":FloatArray( 0, 0.1 ), "transitions":FloatArray( 1, 1 ), "values":[ true, false ] }
  31. [sub_resource type="SampleLibrary" id=4]
  32. samples/shoot = { "db":0.0, "pitch":1.0, "sample":ExtResource( 6 ) }
  33. samples/sound_explode = { "db":0.0, "pitch":1.0, "sample":ExtResource( 7 ) }
  34. [node name="rail" type="Node2D"]
  35. script/script = ExtResource( 1 )
  36. [node name="ship" type="Area2D" parent="."]
  37. transform/pos = Vector2( 253.607, 282.275 )
  38. input/pickable = true
  39. shapes/0/shape = SubResource( 1 )
  40. shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 )
  41. shapes/0/trigger = false
  42. gravity_vec = Vector2( 0, 1 )
  43. gravity = 98.0
  44. linear_damp = 0.1
  45. angular_damp = 1.0
  46. script/script = ExtResource( 2 )
  47. [node name="sprite" type="Sprite" parent="ship"]
  48. texture = ExtResource( 3 )
  49. [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="ship"]
  50. build_mode = 0
  51. polygon = Vector2Array( -20.5637, -15.3227, 25.9104, 1.3603, -20.5637, 14.8656 )
  52. shape_range = Vector2( -1, -1 )
  53. trigger = false
  54. [node name="thruster" type="Particles2D" parent="ship"]
  55. visibility/blend_mode = 1
  56. transform/pos = Vector2( -26.528, -0.358481 )
  57. transform/rot = -91.1436
  58. config/amount = 32
  59. config/lifetime = 2.0
  60. config/time_scale = 5.0
  61. config/emitting = false
  62. config/local_space = false
  63. config/texture = ExtResource( 4 )
  64. params/direction = 0.0
  65. params/spread = 10.0
  66. params/linear_velocity = 20.0
  67. params/spin_velocity = 0.0
  68. params/orbit_velocity = 0.0
  69. params/gravity_direction = 0.0
  70. params/gravity_strength = 0.0
  71. params/radial_accel = 0.0
  72. params/tangential_accel = 0.0
  73. params/damping = 0.0
  74. params/initial_angle = 0.0
  75. params/initial_size = 1.0
  76. params/final_size = 1.0
  77. params/hue_variation = 0.0
  78. params/anim_speed_scale = 1.0
  79. params/anim_initial_pos = 0.0
  80. color/color_ramp = SubResource( 2 )
  81. [node name="anim" type="AnimationPlayer" parent="ship"]
  82. playback/process_mode = 1
  83. playback/default_blend_time = 0.0
  84. root/root = NodePath("..")
  85. anims/explode = SubResource( 3 )
  86. playback/active = true
  87. playback/speed = 1.0
  88. blend_times = [ ]
  89. autoplay = ""
  90. [node name="shootfrom" type="Position2D" parent="ship"]
  91. transform/pos = Vector2( 35.3307, 0.875969 )
  92. [node name="explosion" parent="ship" instance=ExtResource( 5 )]
  93. transform/rot = -91.1436
  94. config/explosiveness = 0.1
  95. params/gravity_strength = 9.8
  96. [node name="sfx" type="SamplePlayer" parent="ship"]
  97. config/polyphony = 1
  98. config/samples = SubResource( 4 )
  99. default/volume_db = 0.0
  100. default/pitch_scale = 1.0
  101. default/pan = 0.0
  102. default/depth = 0.0
  103. default/height = 0.0
  104. default/filter/type = 0
  105. default/filter/cutoff = 0.0
  106. default/filter/resonance = 0.0
  107. default/filter/gain = 0.0
  108. default/reverb_room = 2
  109. default/reverb_send = 0.0
  110. default/chorus_send = 0.0
  111. [node name="camera" type="Camera2D" parent="."]
  112. anchor_mode = 0
  113. rotating = false
  114. current = true
  115. zoom = Vector2( 1, 1 )
  116. limit/left = -10000000
  117. limit/top = -10000000
  118. limit/right = 10000000
  119. limit/bottom = 10000000
  120. drag_margin/h_enabled = true
  121. drag_margin/v_enabled = true
  122. smoothing/enable = false
  123. smoothing/speed = 5.0
  124. drag_margin/left = 0.2
  125. drag_margin/top = 0.2
  126. drag_margin/right = 0.2
  127. drag_margin/bottom = 0.2
  128. [node name="hud" type="CanvasLayer" parent="."]
  129. layer = 1
  130. offset = Vector2( 0, 0 )
  131. rotation = 0.0
  132. scale = Vector2( 1, 1 )
  133. [node name="score" type="Label" parent="hud"]
  134. focus/ignore_mouse = true
  135. focus/stop_mouse = true
  136. size_flags/horizontal = 2
  137. margin/left = 15.0
  138. margin/top = 13.0
  139. margin/right = 66.0
  140. margin/bottom = 26.0
  141. text = "SCORE:"
  142. percent_visible = 1.0
  143. lines_skipped = 0
  144. max_lines_visible = -1
  145. [node name="score_points" type="Label" parent="hud"]
  146. focus/ignore_mouse = true
  147. focus/stop_mouse = true
  148. size_flags/horizontal = 2
  149. margin/left = 70.0
  150. margin/top = 13.0
  151. margin/right = 121.0
  152. margin/bottom = 26.0
  153. text = "0"
  154. align = 1
  155. percent_visible = 1.0
  156. lines_skipped = 0
  157. max_lines_visible = -1
  158. [node name="back_to_menu" type="Button" parent="hud"]
  159. focus/ignore_mouse = false
  160. focus/stop_mouse = true
  161. size_flags/horizontal = 2
  162. size_flags/vertical = 2
  163. margin/left = 911.0
  164. margin/top = 10.0
  165. margin/right = 1006.0
  166. margin/bottom = 31.0
  167. toggle_mode = false
  168. text = "Back to Menu"
  169. flat = false
  170. [node name="game_over" type="Label" parent="hud"]
  171. visibility/visible = false
  172. focus/ignore_mouse = true
  173. focus/stop_mouse = true
  174. size_flags/horizontal = 2
  175. margin/left = 482.0
  176. margin/top = 286.0
  177. margin/right = 564.0
  178. margin/bottom = 299.0
  179. text = "GAME_OVER"
  180. percent_visible = 1.0
  181. lines_skipped = 0
  182. max_lines_visible = -1
  183. [connection signal="body_enter" from="ship" to="ship" method="_on_ship_body_enter"]
  184. [connection signal="area_enter" from="ship" to="ship" method="_on_ship_area_enter"]
  185. [connection signal="pressed" from="hud/back_to_menu" to="ship" method="_on_back_to_menu_pressed"]