1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-30 07:51:54 +08:00

feat(子弹): 重构小鸡激光攻击并优化子弹行为

- 替换原有Laser为ChickLaser,实现更华丽的激光效果
- 调整FireScan子弹速度和伤害值
- 优化Diamond子弹追踪逻辑和持续时间
- 新增PresetsAI.lockLauncher方法用于固定子弹位置
- 调整Chick角色的攻击冷却时间和攻击距离判定
This commit is contained in:
2025-08-29 11:17:02 +08:00
parent 187100f500
commit 5c16dcc294
10 changed files with 268 additions and 68 deletions
+225
View File
@@ -0,0 +1,225 @@
[gd_scene load_steps=15 format=3 uid="uid://bvri0nv1jrigf"]
[ext_resource type="PackedScene" uid="uid://8gjjfju6p3fh" path="res://components/Bullets/Common/LaserSummoner.tscn" id="1_eb54j"]
[ext_resource type="Script" path="res://scripts/Contents/Bullets/ChickLaser.gd" id="2_7g0f0"]
[ext_resource type="Shader" path="res://shaders/BigLaser.gdshader" id="3_4y0mm"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_x6ivr"]
shader = ExtResource("3_4y0mm")
shader_parameter/laser_color = Color(0, 0.507813, 1, 1)
shader_parameter/width = 1.0
shader_parameter/softness = 0.5
shader_parameter/wave_speed = 1.0
shader_parameter/wave_frequency = 1.0
shader_parameter/wave_amplitude = 0.5
shader_parameter/wave_width = 0.5
shader_parameter/edge_nonalpha = 0.6
[sub_resource type="Curve" id="Curve_4f20s"]
_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_ftxbx"]
curve = SubResource("Curve_4f20s")
[sub_resource type="Curve" id="Curve_ffsha"]
_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_5b6jo"]
curve = SubResource("Curve_ffsha")
[sub_resource type="Gradient" id="Gradient_rbqh5"]
offsets = PackedFloat32Array(0, 0.553435)
colors = PackedColorArray(1, 1, 1, 1, 0, 0.695313, 1, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_y1x3v"]
gradient = SubResource("Gradient_rbqh5")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_vb8yw"]
particle_flag_disable_z = true
emission_shape = 3
emission_box_extents = Vector3(0, 250, 1)
angle_min = 1.07288e-05
angle_max = 360.0
angle_curve = SubResource("CurveTexture_5b6jo")
spread = 15.0
initial_velocity_min = -500.0
initial_velocity_max = 500.0
gravity = Vector3(0, 0, 0)
scale_min = 3.0
scale_max = 15.0
color_ramp = SubResource("GradientTexture1D_y1x3v")
alpha_curve = SubResource("CurveTexture_ftxbx")
[sub_resource type="Animation" id="Animation_1rif1"]
length = 0.001
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("rect:position:y")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/1/type = "bezier"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("rect:scale:x")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/2/type = "bezier"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("circle:rotation")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/3/type = "bezier"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("circle:scale:x")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/4/type = "bezier"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("circle:scale:y")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/5/type = "bezier"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("circle:modulate:a")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
[sub_resource type="Animation" id="Animation_ep0ow"]
resource_name = "spawn"
length = 5.0
step = 0.05
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("rect:position:y")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0, 0, 0, 0),
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 25, -0.25, 0, 0.25, 0, 25, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0, 0.5, 4.5, 5)
}
tracks/1/type = "bezier"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("rect:scale:x")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"handle_modes": PackedInt32Array(0, 0, 0, 0),
"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 1e-05, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0, 0.5, 4.5, 5)
}
tracks/2/type = "bezier"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("circle:rotation")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 25.1327, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0, 5)
}
tracks/3/type = "bezier"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("circle:scale:x")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"handle_modes": PackedInt32Array(0, 0, 0, 0),
"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 1e-05, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0, 0.5, 4.5, 5)
}
tracks/4/type = "bezier"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("circle:scale:y")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"handle_modes": PackedInt32Array(0, 0, 0, 0),
"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 1e-05, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0, 0.5, 4.5, 5)
}
tracks/5/type = "bezier"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("circle:modulate:a")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"handle_modes": PackedInt32Array(0, 0, 0, 0),
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0, 0.5, 4.5, 5)
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7qqtc"]
_data = {
"RESET": SubResource("Animation_1rif1"),
"spawn": SubResource("Animation_ep0ow")
}
[node name="ChickLaser" instance=ExtResource("1_eb54j")]
script = ExtResource("2_7g0f0")
[node name="rect" parent="texture" index="0"]
material = SubResource("ShaderMaterial_x6ivr")
offset_left = 204.0
offset_top = 0.0
offset_right = 254.0
offset_bottom = 500.0
[node name="particles" parent="texture/rect" index="0"]
position = Vector2(25, 250)
amount = 100
process_material = SubResource("ParticleProcessMaterial_vb8yw")
lifetime = 0.1
visibility_rect = Rect2(-50, -250, 100, 500)
[node name="launcher" parent="texture/rect" index="1"]
position = Vector2(25, -21)
scale = Vector2(0.525, 0.525)
[node name="animator" parent="texture" index="1"]
libraries = {
"": SubResource("AnimationLibrary_7qqtc")
}
+18 -17
View File
@@ -18,42 +18,42 @@ shader_parameter/wave_amplitude = 0.5
shader_parameter/wave_width = 0.5
shader_parameter/edge_nonalpha = 0.6
[sub_resource type="Curve" id="Curve_m7ued"]
[sub_resource type="Curve" id="Curve_itlbo"]
_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_iykvy"]
curve = SubResource("Curve_m7ued")
[sub_resource type="CurveTexture" id="CurveTexture_xathl"]
curve = SubResource("Curve_itlbo")
[sub_resource type="Curve" id="Curve_7w1gn"]
[sub_resource type="Curve" id="Curve_75ctq"]
_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_nimkb"]
curve = SubResource("Curve_7w1gn")
[sub_resource type="CurveTexture" id="CurveTexture_my7uy"]
curve = SubResource("Curve_75ctq")
[sub_resource type="Gradient" id="Gradient_krx08"]
offsets = PackedFloat32Array(0, 0.553435)
[sub_resource type="Gradient" id="Gradient_62xhh"]
offsets = PackedFloat32Array(0, 0.60687)
colors = PackedColorArray(1, 1, 1, 1, 1, 0, 0, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_l66oc"]
gradient = SubResource("Gradient_krx08")
[sub_resource type="GradientTexture1D" id="GradientTexture1D_yix5j"]
gradient = SubResource("Gradient_62xhh")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_n3bsp"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_m7jvq"]
particle_flag_disable_z = true
emission_shape = 3
emission_box_extents = Vector3(0, 1000, 1)
angle_min = 1.07288e-05
angle_max = 360.0
angle_curve = SubResource("CurveTexture_nimkb")
angle_curve = SubResource("CurveTexture_my7uy")
spread = 15.0
initial_velocity_min = -500.0
initial_velocity_max = 500.0
gravity = Vector3(0, 0, 0)
scale_min = 3.0
scale_max = 15.0
color_ramp = SubResource("GradientTexture1D_l66oc")
alpha_curve = SubResource("CurveTexture_iykvy")
color_ramp = SubResource("GradientTexture1D_yix5j")
alpha_curve = SubResource("CurveTexture_xathl")
[sub_resource type="Animation" id="Animation_1rif1"]
length = 0.001
@@ -136,7 +136,7 @@ tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0, 0, 0, 0),
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 50, -0.25, 0, 0.25, 0, 50, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0),
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 25, -0.25, 0, 0.25, 0, 25, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0, 0.5, 4.5, 5)
}
tracks/1/type = "bezier"
@@ -216,15 +216,16 @@ sprite_frames = SubResource("SpriteFrames_yip5k")
[node name="rect" type="ColorRect" parent="texture" index="0"]
material = SubResource("ShaderMaterial_b2oy8")
offset_left = 233.0
offset_top = 50.0
offset_right = 333.0
offset_bottom = 2000.0
offset_bottom = 2050.0
rotation = -1.5708
scale = Vector2(1e-05, 1)
[node name="particles" type="GPUParticles2D" parent="texture/rect" index="0"]
position = Vector2(50, 1000)
amount = 400
process_material = SubResource("ParticleProcessMaterial_n3bsp")
process_material = SubResource("ParticleProcessMaterial_m7jvq")
lifetime = 0.25
visibility_rect = Rect2(-100, -1000, 200, 2000)
-35
View File
@@ -1,35 +0,0 @@
[gd_scene load_steps=7 format=3 uid="uid://bvri0nv1jrigf"]
[ext_resource type="PackedScene" uid="uid://crtdkysmnkith" path="res://components/Abstracts/BulletBase.tscn" id="1_3u4op"]
[ext_resource type="Shader" path="res://shaders/Laser.gdshader" id="2_h6cxi"]
[ext_resource type="Script" path="res://scripts/Contents/Bullets/Laser.gd" id="2_yy5sr"]
[sub_resource type="SpriteFrames" id="SpriteFrames_yip5k"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_5n8cv"]
shader = ExtResource("2_h6cxi")
shader_parameter/color = Color(0.654902, 1, 1, 1)
shader_parameter/laser_width = 0.01
shader_parameter/soft_edge = 0.5
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_y85id"]
height = 300.0
[node name="Laser" instance=ExtResource("1_3u4op")]
script = ExtResource("2_yy5sr")
lifeTime = 2000.0
[node name="texture" parent="." index="0"]
rotation = 1.5708
sprite_frames = SubResource("SpriteFrames_yip5k")
[node name="rect" type="ColorRect" parent="texture" index="0"]
material = SubResource("ShaderMaterial_5n8cv")
offset_left = -10.0
offset_top = -300.0
offset_right = 10.0
[node name="hitbox" parent="." index="1"]
position = Vector2(150, 0)
rotation = 1.5708
shape = SubResource("CapsuleShape2D_y85id")
+1 -3
View File
@@ -32,18 +32,16 @@ animations = [{
[node name="Chick" instance=ExtResource("1_goqmy")]
script = ExtResource("2_r6bub")
cooldownUnit = 3000.0
isBoss = true
displayName = "小鸡"
drops = Array[int]([0, 1])
dropCounts = Array[Vector2]([Vector2(10, 30), Vector2(15, 50)])
appleCount = Vector2i(2, 4)
energy = 1000.0
[node name="hurt" parent="sounds" index="3"]
stream = ExtResource("3_ik1xf")
[node name="attack1" type="AudioStreamPlayer2D" parent="sounds" index="4"]
[node name="attack1" type="AudioStreamPlayer2D" parent="sounds" index="6"]
stream = ExtResource("4_oyq2p")
[node name="texture" parent="." index="1"]
+8
View File
@@ -0,0 +1,8 @@
extends BulletBase
class_name Laser
func register():
penerate = 1
func ai():
rotation_degrees += 1
PresetsAI.lockLauncher(self, launcher, true)
+3 -2
View File
@@ -1,11 +1,12 @@
extends BulletBase
class_name Diamond
const traceTime = 2000
const traceTime = 1500
func register():
damage = 2
func ai():
rotation = lerp_angle(rotation, position.angle_to_point(launcher.currentFocusedBoss.position), 0.1 * clamp((traceTime - timeLived()) / traceTime, 0, INF))
canDamageSelf = !(timeLived() >= traceTime)
PresetsAI.forward(self, rotation)
if timeLived() < traceTime:
PresetsAI.trace(self, launcher.currentFocusedBoss.position, 0.05)
+2 -2
View File
@@ -2,8 +2,8 @@ extends BulletBase
class_name FireScan
func register():
speed = 5
damage = 20
speed = 2
damage = 1
func ai():
PresetsAI.forward(self, rotation)
-6
View File
@@ -1,6 +0,0 @@
extends BulletBase
class_name Laser
func ai():
rotation_degrees += 5
position = launcher.texture.global_position
@@ -1,4 +1,12 @@
class_name PresetsAI
static func lockLauncher(bullet: BulletBase, launcher: EntityBase, onTexture: bool = false):
bullet.position = launcher.texture.global_position if onTexture else launcher.position
static func forward(bullet: BulletBase, rotation: float):
bullet.forward(Vector2.from_angle(rotation))
static func trace(bullet: BulletBase, target: Vector2, speed: float):
bullet.rotation = lerp_angle(
bullet.rotation,
bullet.position.angle_to_point(target),
speed
)
+3 -3
View File
@@ -9,14 +9,14 @@ func register():
fields[FieldStore.Entity.MAX_HEALTH] = 2000
fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.35
attackCooldownMap[0] = 2000
attackCooldownMap[1] = 3000
attackCooldownMap[1] = 6000
attackCooldownMap[2] = 100
func ai():
move(currentFocusedBoss.position - position)
if currentFocusedBoss.position.distance_to(position) < 200:
tryAttack(2)
elif currentFocusedBoss.position.distance_to(position) < 400:
elif currentFocusedBoss.position.distance_to(position) < 500:
tryAttack(1)
else:
tryAttack(0)
@@ -27,7 +27,7 @@ func attack(type):
BulletBase.generate(preload("res://components/Bullets/Diamond.tscn"), self, weaponPos + MathTool.randv2_range(20), rotation + deg_to_rad(randf_range(-90, 90)))
elif type == 1:
for i in range(laserCount):
BulletBase.generate(preload("res://components/Bullets/Laser.tscn"), self, texture.global_position, deg_to_rad(90 * i))
BulletBase.generate(preload("res://components/Bullets/ChickLaser.tscn"), self, texture.global_position, deg_to_rad(90 * i))
elif type == 2:
var weaponPos = findWeaponAnchor("normal")
var target = weaponPos.angle_to_point(currentFocusedBoss.position)