From 74c44ee09ab29a6ffd82e696d4b3eddd8d5ec36c Mon Sep 17 00:00:00 2001 From: dpDeadlyPuzzles <1976985776@qq.com> Date: Fri, 12 Jul 2024 10:51:35 +0800 Subject: [PATCH] feat: seedler_nut super_burst --- scenes/bullets/seedler/seedler_nut.gd | 55 +++++++++++++++----- scenes/fight.tscn | 10 ++++ scenes/weapons/star_wrath/star_wrath.gd | 3 +- scenes/weapons/star_wrath/star_wrath_root.gd | 4 ++ 4 files changed, 58 insertions(+), 14 deletions(-) diff --git a/scenes/bullets/seedler/seedler_nut.gd b/scenes/bullets/seedler/seedler_nut.gd index 57c53ef..6b45b25 100644 --- a/scenes/bullets/seedler/seedler_nut.gd +++ b/scenes/bullets/seedler/seedler_nut.gd @@ -64,46 +64,75 @@ func burst_shot_beam(): get_parent().add_child(beam) +func change_alpha(x: float): + alpha = x + queue_redraw() + + # 启动超级爆炸 # 最大, 原地旋转 func super_burst(pos: Vector2): - const TIME = 0.8 + const TIME = 1.2 const WAIT_TIME = 0.65 # TAU / s const SPEED = 1.5 * TAU position = pos + rotation = randf_range(0, TAU) scale = Vector2(2, 2) + line1_from = 70 * Vector2(cos(TAU / 12 * 1), sin(TAU / 12 * 1)) + line1_to = 70 * Vector2(cos(TAU / 12 * 7), sin(TAU / 12 * 7)) + line2_from = 70 * Vector2(cos(TAU / 12 * 4), sin(TAU / 12 * 4)) + line2_to = 70 * Vector2(cos(TAU / 12 * 10), sin(TAU / 12 * 10)) + var line = create_tween() + line.tween_interval(TIME / 4) + line.tween_method(change_alpha, 0.01, 0.7, TIME / 2) + line.tween_method(change_alpha, 0.7, 0.01, TIME / 4) var tween = create_tween() - tween.tween_property(self, "rotation", rotation + SPEED * TIME, TIME) - tween.tween_callback(super_burst_shot_beam.bind()) + tween.tween_property($Sprite2D, "rotation", $Sprite2D.rotation + SPEED * TIME, TIME) + tween.tween_callback(super_burst_shot_beam) + tween.tween_callback($Sprite2D.queue_free) tween.tween_interval(WAIT_TIME) tween.tween_callback(queue_free) +var alpha: float +var line1_from: Vector2 +var line1_to: Vector2 +var line2_from: Vector2 +var line2_to: Vector2 +const width = 8 + + +func _draw(): + var yellow = Color(Color.GOLD, alpha) + draw_line(line1_from, line1_to, yellow, width) + draw_line(line2_from, line2_to, yellow, width) + + func super_burst_shot_beam(): const TIMES = 12 - const NUM = 6 + const NUM = 8 for j in range(NUM): - print("aaa") var beams: Array[Area2D] = [] for i in range(TIMES): beams.push_back(thorns.instantiate()) beams[i].is_fall = false beams[i].position = position - var rad = TAU / TIMES * i + (TAU / 12 if i % 2 == 0 else -TAU / 12) - beams[i].velocity = Vector2(sin(rad), cos(rad)) * 800 + var rad = TAU / TIMES * i + rotation + if i % 3 == 0: + rad += PI / 10 + elif i % 3 == 2: + rad -= PI / 10 + beams[i].velocity = Vector2(cos(rad), sin(rad)) * 1600 for beam in beams: get_parent().add_child(beam) - await get_tree().create_timer(0.1).timeout + await get_tree().create_timer(0.05).timeout func _ready(): $OutScreen.screen_exited.connect(queue_free) - super_burst(Vector2(300, 300)) - - -func _process(_delta): - pass + if get_tree().current_scene == self: + super_burst(Vector2(300, 300)) func _on_area_entered(area): diff --git a/scenes/fight.tscn b/scenes/fight.tscn index 895f28c..42746d9 100644 --- a/scenes/fight.tscn +++ b/scenes/fight.tscn @@ -72,6 +72,16 @@ scale = Vector2(3.28571, 3.28571) texture = ExtResource("1_jsdtx") [node name="SwordManager" type="SwordManager" parent="."] +_import_path = NodePath("") +unique_name_in_owner = false +process_mode = 0 +process_priority = 0 +process_physics_priority = 0 +process_thread_group = 0 +physics_interpolation_mode = 0 +auto_translate_mode = 0 +editor_description = "" +script = null [node name="StarWrath" parent="SwordManager" instance=ExtResource("4_8ipx5")] diff --git a/scenes/weapons/star_wrath/star_wrath.gd b/scenes/weapons/star_wrath/star_wrath.gd index 47569f8..8a0f38b 100644 --- a/scenes/weapons/star_wrath/star_wrath.gd +++ b/scenes/weapons/star_wrath/star_wrath.gd @@ -22,7 +22,8 @@ func next_operation(): operations[operation_idx].call() operation_idx += 1 + func fall_star_process(): for i in range(10): self.fall_star() - await get_tree().create_timer(randf_range(1.0,2.0)).timeout + await get_tree().create_timer(randf_range(1.0, 2.0)).timeout diff --git a/scenes/weapons/star_wrath/star_wrath_root.gd b/scenes/weapons/star_wrath/star_wrath_root.gd index 7f4a30b..117271d 100644 --- a/scenes/weapons/star_wrath/star_wrath_root.gd +++ b/scenes/weapons/star_wrath/star_wrath_root.gd @@ -2,6 +2,7 @@ extends Node signal attack_finished + # Called when the node enters the scene tree for the first time. func _ready() -> void: if get_tree().current_scene == self: @@ -9,14 +10,17 @@ func _ready() -> void: else: hide() + func hide(): $StarWrath.hide() $Bg.hide() + func show(): $StarWrath.show() $Bg.show() + func start(): show() $StarWrath.start()