1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 15:01:53 +08:00
Files
Dog-Lynx-And-HCN/scripts/Contents/Characters/MTY.gd
T

27 lines
789 B
GDScript
Raw Normal View History

extends EntityBase
class_name MTY
func register():
fields[FieldStore.Entity.MAX_HEALTH] = 400
fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.9
attackCooldownMap[0] = 1000
attackCooldownMap[1] = 250
sprintMultiplier = 5
func spawn():
texture.play("walk")
func ai():
PresetEntityAI.follow(self, currentFocusedBoss)
tryAttack(0)
2025-12-14 15:29:44 +08:00
tryAttack(1)
func attack(type: int):
if type == 0:
trySprint()
2025-12-14 15:29:44 +08:00
elif type == 1:
BulletBase.generate(ComponentManager.getBullet("MTYSprint"), self, position, 0)
return true
func sprint():
var target = BulletTool.findClosetBulletCanDamage(position, get_tree(), self)
if is_instance_valid(target):
var dir = (target.position - position).rotated(MathTool.randomChoiceFrom([-1, 1]) * deg_to_rad(90))
move(dir.normalized() * sprintMultiplier, true)