mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
b343708b3b
feat(角色): 为Kernyr和CyberCat添加新攻击类型 refactor(角色): 更新Kernyr角色贴图和显示名称 feat(关卡): 调整测试关卡配置和敌人波次 style: 更新子弹资源文件及导入配置
69 lines
2.0 KiB
GDScript
69 lines
2.0 KiB
GDScript
extends EntityBase
|
|
class_name Kernyr
|
|
|
|
var attack1Angle = 0
|
|
var attack0State = 0
|
|
var attack2Start = 0
|
|
|
|
func register():
|
|
fields[FieldStore.Entity.MAX_HEALTH] = 2000
|
|
fields[FieldStore.Entity.OFFSET_SHOOT] = 20
|
|
attackCooldownMap[0] = 2000
|
|
attackCooldownMap[1] = 100
|
|
attackCooldownMap[2] = 10000
|
|
attackCooldownMap[3] = 4500
|
|
attackMutexes = [2]
|
|
func ai():
|
|
for i in 3:
|
|
tryAttack(i, [2])
|
|
# tryAttack(3)
|
|
func attack(type: int):
|
|
if type == 0:
|
|
for i in randi_range(7, 16):
|
|
BulletBase.generate(ComponentManager.getBullet("Diamond"), self , position + MathTool.sampleInCircle(20), rotation + deg_to_rad(randf_range(-90, 90)))
|
|
var states = [
|
|
Vector2(-1, 1),
|
|
Vector2(1, 1),
|
|
Vector2(1, -1),
|
|
Vector2(-1, -1)
|
|
]
|
|
await sprintTo(currentFocusedBoss.position + 400 * states[attack0State % len(states)], 0.1)
|
|
attack0State += 1
|
|
BulletBase.generate(ComponentManager.getBullet("HeavyCrystal"), self , findWeaponAnchor("normal"), position.angle_to_point(currentFocusedBoss.position))
|
|
elif type == 1:
|
|
BulletBase.generate(
|
|
ComponentManager.getBullet("Yangyi"),
|
|
self ,
|
|
position,
|
|
attack1Angle
|
|
)
|
|
attack1Angle += deg_to_rad(360.0 / 20)
|
|
elif type == 2:
|
|
var anchor = currentFocusedBoss.position
|
|
var radius = 600
|
|
var count = 10.0
|
|
var i = 0
|
|
var currentAngle = 0
|
|
var time = 500.0
|
|
await sprintTo(anchor + Vector2(0, -radius), 0.1)
|
|
attack2Start = timeLived()
|
|
while timeLived() - attack2Start <= time:
|
|
var targetAngle = deg_to_rad(i / count * 360.0 - 90)
|
|
currentAngle = deg_to_rad((timeLived() - attack2Start) / time * 360.0 - 90)
|
|
position = anchor + Vector2.from_angle(currentAngle) * radius
|
|
if currentAngle >= targetAngle:
|
|
i += 1
|
|
for bullet in BulletBase.generate(
|
|
ComponentManager.getBullet("Egg"),
|
|
self ,
|
|
position,
|
|
0
|
|
):
|
|
if bullet is EggBullet:
|
|
bullet.look_at(anchor)
|
|
await TickTool.frame()
|
|
await TickTool.millseconds(2000)
|
|
await chargeUp()
|
|
elif type == 3:
|
|
BulletBase.generate(ComponentManager.getBullet("Bengbeng"), self , position, 0)
|