1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-27 22:41:56 +08:00

feat(子弹): 为弓箭子弹添加蓄力效果和粒子特效

添加蓄力等待时间和粒子特效系统,使弓箭在发射前有蓄力效果,并在发射时显示火焰粒子特效。修改了Bow.gd和Arrow.gd以支持蓄力时间参数,并更新Arrow.tscn添加新的粒子系统节点。
This commit is contained in:
2025-11-18 22:19:56 +08:00
parent f8f76d5725
commit f9601c4d13
3 changed files with 53 additions and 3 deletions
+35 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=3 uid="uid://wy8wqwhwr4fb"]
[gd_scene load_steps=13 format=3 uid="uid://wy8wqwhwr4fb"]
[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_0wuio"]
[ext_resource type="Texture2D" uid="uid://dadbn306owsy3" path="res://resources/bullets/arrow/arrow.png" id="2_b2ohg"]
@@ -20,6 +20,32 @@ initial_velocity_max = 3000.0
gravity = Vector3(0, 0, 0)
alpha_curve = SubResource("CurveTexture_cawe8")
[sub_resource type="Curve" id="Curve_qddg0"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_uu3a4"]
curve = SubResource("Curve_qddg0")
[sub_resource type="Gradient" id="Gradient_cawe8"]
colors = PackedColorArray(1, 0, 0, 1, 1, 0.8159592, 0, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_afwvr"]
gradient = SubResource("Gradient_cawe8")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_qddg0"]
particle_flag_disable_z = true
emission_shape = 1
emission_sphere_radius = 150.0
direction = Vector3(-1, 0, 0)
spread = 20.0
initial_velocity_max = 2500.0
gravity = Vector3(0, 0, 0)
scale_min = 20.0
scale_max = 60.0
color_initial_ramp = SubResource("GradientTexture1D_afwvr")
alpha_curve = SubResource("CurveTexture_uu3a4")
[sub_resource type="CircleShape2D" id="CircleShape2D_b2ohg"]
[node name="Arrow" instance=ExtResource("1_0wuio")]
@@ -35,6 +61,7 @@ scale = Vector2(0.06775362, 0.06775362)
texture = ExtResource("2_b2ohg")
[node name="trail" type="GPUParticles2D" parent="texture/static" index="0"]
unique_name_in_owner = true
z_index = -1
amount = 12
texture = ExtResource("2_b2ohg")
@@ -42,6 +69,13 @@ preprocess = 1.0
local_coords = true
process_material = SubResource("ParticleProcessMaterial_afwvr")
[node name="fire" type="GPUParticles2D" parent="texture/static" index="1"]
position = Vector2(1328.3423, 44.278076)
amount = 300
preprocess = 1.0
local_coords = true
process_material = SubResource("ParticleProcessMaterial_qddg0")
[node name="hitbox" parent="." index="1"]
position = Vector2(85, 0)
shape = SubResource("CircleShape2D_b2ohg")
+15 -1
View File
@@ -1,9 +1,23 @@
extends BulletBase
class_name Arrow
var atk: float = 0
@onready var trail: GPUParticles2D = $%trail
var atk: float = 0
var waitTime: float = 0
func register():
trail.emitting = false
hitbox.disabled = true
func ai():
if timeLived() < waitTime:
PresetBulletAI.lockLauncher(self, launcher, true)
rotation = position.angle_to_point(get_global_mouse_position())
position += Vector2.from_angle(rotation) * 200
return
else:
trail.emitting = true
hitbox.disabled = false
speed = (1 - lifeDistancePercent()) * initialSpeed
damage = speed * atk
PresetBulletAI.forward(self, rotation)
+3 -1
View File
@@ -3,9 +3,9 @@ class_name Bow
var count: int = 0
var atk: float = 0
var waitTime: float = 1000
func spawn():
await TickTool.millseconds(1000)
var startAngle = rotation - deg_to_rad(count * 10.0 / 2)
for c in count:
for i in BulletBase.generate(
@@ -16,6 +16,8 @@ func spawn():
):
var bullet: Arrow = i
bullet.atk = atk
bullet.waitTime = waitTime
await TickTool.millseconds(waitTime)
tryDestroy()
func ai():
PresetBulletAI.lockLauncher(self, launcher, true)