1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-30 16:01:53 +08:00
Files
Dog-Lynx-And-HCN/scripts/Contents/Characters/MTY.gd
T
fallingshrimp 3a8c48dae7 feat(子弹): 为魔法飞弹添加命中动画和音效
refactor(角色): 将MTY角色从猫头鹰改为狗熊宝宝并调整攻击逻辑

fix(子弹): 修复ParryBall和Parrier子弹的实例有效性检查

style(场景): 清理场景文件中的冗余属性

feat(工具): 为findClosetBulletCanDamage添加最大距离参数

chore(配置): 更新测试用的波次配置
2026-04-24 18:09:24 +08:00

37 lines
1.3 KiB
GDScript

extends EntityBase
class_name MTY
func register():
fields[FieldStore.Entity.MAX_HEALTH] = 400
fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.9
attackCooldownMap[0] = 2000
attackCooldownMap[1] = 750
attackCooldownMap[2] = 450
sprintMultiplier = 5
func spawn():
texture.play("walk")
func ai():
PresetEntityAI.follow(self , currentFocusedBoss)
for i in 3:
tryAttack(i)
func attack(type: int):
if type == 0:
trySprint()
elif type == 1:
var track = getTrackingAnchor()
var bullet = BulletTool.findClosetBulletCanDamage(track, get_tree(), self , 400)
if is_instance_valid(bullet):
BulletBase.generate(ComponentManager.getBullet("Parrier"), self , track, track.angle_to_point(bullet.position))
elif type == 2:
if is_instance_valid(currentFocusedBoss):
var track = getTrackingAnchor()
if currentFocusedBoss.position.distance_to(track) <= 400:
BulletBase.generate(ComponentManager.getBullet("Parrier"), self , track, track.angle_to_point(currentFocusedBoss.position))
return true
func sprint():
var track = getTrackingAnchor()
var target = BulletTool.findClosetBulletCanDamage(track, get_tree(), self , 300)
if is_instance_valid(target):
var dir = (target.position - track).rotated(MathTool.randomChoiceFrom([-1, 1]) * deg_to_rad(90))
move(dir.normalized() * sprintMultiplier, true)