mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
2105de1131
添加新的Egg子弹类型,包括脚本、纹理和场景文件。更新Kernyr角色的攻击逻辑以使用Egg子弹。新增篮球和雷电纹理资源及其导入配置。
57 lines
1.6 KiB
GDScript
57 lines
1.6 KiB
GDScript
extends EntityBase
|
|
class_name Kernyr
|
|
|
|
var attack1Angle = 0
|
|
var attack0State = 0
|
|
|
|
func register():
|
|
fields[FieldStore.Entity.MAX_HEALTH] = 2000
|
|
fields[FieldStore.Entity.OFFSET_SHOOT] = 20
|
|
attackCooldownMap[0] = 2000
|
|
attackCooldownMap[1] = 100
|
|
attackCooldownMap[2] = 10000
|
|
attackMutexes = [2]
|
|
func ai():
|
|
for i in 3:
|
|
tryAttack(i)
|
|
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
|
|
await sprintTo(anchor + Vector2(0, -radius), 0.1)
|
|
await TickTool.millseconds(500)
|
|
await chargeUp()
|
|
var count = 10.0
|
|
for i in count:
|
|
await sprintTo(anchor + Vector2.from_angle(deg_to_rad(i / count * 360.0 - 90)) * radius, 0.5)
|
|
for bullet in BulletBase.generate(
|
|
ComponentManager.getBullet("Egg"),
|
|
self ,
|
|
position,
|
|
0
|
|
):
|
|
if bullet is EggBullet:
|
|
bullet.look_at(anchor)
|
|
await TickTool.millseconds(2000)
|
|
await chargeUp()
|