mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat(角色): 添加猫头鹰角色MTY及其冲刺攻击能力
添加新角色MTY(猫头鹰)及其专属子弹MTYSprint - 实现MTY角色的基本属性和AI行为 - 添加MTYSprint子弹类型及碰撞检测 - 在Wave.gd中添加MTY的生成配置 - 扩展BulletTool工具类添加查找最近子弹功能
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
extends EntityBase
|
||||
class_name MTY
|
||||
|
||||
func register():
|
||||
fields[FieldStore.Entity.MAX_HEALTH] = 400
|
||||
fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.9
|
||||
attackCooldownMap[0] = 1500
|
||||
sprintMultiplier = 5
|
||||
func spawn():
|
||||
BulletBase.generate(ComponentManager.getBullet("MTYSprint"), self, position, 0)
|
||||
func ai():
|
||||
PresetEntityAI.follow(self, currentFocusedBoss)
|
||||
tryAttack(0)
|
||||
func attack(type: int):
|
||||
if type == 0:
|
||||
trySprint()
|
||||
return true
|
||||
func sprint():
|
||||
var target = BulletTool.findClosetBulletCanDamage(position, get_tree(), self)
|
||||
if is_instance_valid(target):
|
||||
var dir = (target.position - position).rotated(MathTool.randc_from([-1, 1]) * deg_to_rad(90))
|
||||
move(dir.normalized() * sprintMultiplier, true)
|
||||
@@ -0,0 +1 @@
|
||||
uid://b80jr04qpitly
|
||||
Reference in New Issue
Block a user