1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 23:11:54 +08:00
Files
Dog-Lynx-And-HCN/scripts/Contents/Characters/Chick.gd
T
fallingshrimp bd8a7d5d2c feat(音效/特效): 添加角色死亡音效和血液特效
添加多个音效文件并实现角色死亡时的血液粒子效果
调整冲刺逻辑和数值,修复激光子弹的显示位置
为不同攻击类型添加对应音效,增强游戏表现力
2025-08-29 14:29:07 +08:00

48 lines
1.7 KiB
GDScript

extends EntityBase
class_name Chick
@onready var firepot = $"%firepot"
const laserCount = 4
func register():
fields[FieldStore.Entity.MAX_HEALTH] = 2000
fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.35
attackCooldownMap[0] = 500
attackCooldownMap[1] = 6000
attackCooldownMap[2] = 100
attackCooldownMap[3] = 500
sprintMultiplier = 60
func spawn():
texture.play("walk")
func ai():
move(currentFocusedBoss.position - position)
if currentFocusedBoss.position.distance_to(position) < 300:
tryAttack(2)
elif currentFocusedBoss.position.distance_to(position) < 700:
tryAttack(1)
else:
var method = MathTool.randc_from([0, 3, 0]) # 0: 钻石, 1: 激光, 2: 喷火, 3: 冲刺,这里随机到钻石的概率比冲刺大一倍
tryAttack(method, method == 3)
func attack(type):
if type == 0:
var weaponPos = findWeaponAnchor("normal")
for i in randi_range(10, 20):
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/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)
firepot.global_rotation = target
firepot.shot()
BulletBase.generate(preload("res://components/Bullets/FireScan.tscn"), self, weaponPos, target)
elif type == 3:
BulletBase.generate(preload("res://components/Bullets/ChickSprint.tscn"), self, position, 0)
trySprint()
return true
func sprint():
move((currentFocusedBoss.position - position).normalized() * sprintMultiplier, true)