1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-29 23:41: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
+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)