Skip to content

Commit

Permalink
feat: seedler_nut super_burst
Browse files Browse the repository at this point in the history
  • Loading branch information
wlywlywlywly committed Jul 12, 2024
1 parent 94ecf9a commit 74c44ee
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 14 deletions.
55 changes: 42 additions & 13 deletions scenes/bullets/seedler/seedler_nut.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 10 additions & 0 deletions scenes/fight.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

Expand Down
3 changes: 2 additions & 1 deletion scenes/weapons/star_wrath/star_wrath.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions scenes/weapons/star_wrath/star_wrath_root.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@ 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:
self.start()
else:
hide()


func hide():
$StarWrath.hide()
$Bg.hide()


func show():
$StarWrath.show()
$Bg.show()


func start():
show()
$StarWrath.start()

0 comments on commit 74c44ee

Please sign in to comment.