1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-27 22:41:56 +08:00

feat(子弹): 为魔法飞弹添加命中动画和音效

refactor(角色): 将MTY角色从猫头鹰改为狗熊宝宝并调整攻击逻辑

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

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

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

chore(配置): 更新测试用的波次配置
This commit is contained in:
2026-04-24 18:09:24 +08:00
parent f27d75befd
commit 3a8c48dae7
12 changed files with 161 additions and 60 deletions
+9 -9
View File
@@ -27,7 +27,7 @@ func spawn():
if MathTool.rate(0.01):
setStage(2)
func ai():
PresetEntityAI.follow(self, currentFocusedBoss, 250)
PresetEntityAI.follow(self , currentFocusedBoss, 250)
for i in len(attackCooldownMap.keys()):
tryAttack(i)
func enterStage(stage):
@@ -50,7 +50,7 @@ func attack(type):
playSound("attack0")
for i in randi_range(20, 30):
if !is_instance_valid(currentFocusedBoss): return false
for bullet in BulletBase.generate(ComponentManager.getBullet("ArrowSeven"), self, findWeaponAnchor("normal"), deg_to_rad(randf_range(0, 360))):
for bullet in BulletBase.generate(ComponentManager.getBullet("ArrowSeven"), self , findWeaponAnchor("normal"), deg_to_rad(randf_range(0, 360))):
bullet.tracer = currentFocusedBoss
bullet.position += MathTool.sampleInCircle(50)
await TickTool.millseconds(50)
@@ -59,10 +59,10 @@ func attack(type):
await sprintTo(currentFocusedBoss.position - Vector2(MathTool.randomChoiceFrom([-300, 300]), 300), 0.25)
var count = randi_range(6, 8)
for i in range(count):
BulletBase.generate(ComponentManager.getBullet("SunDance"), self, weaponPos, deg_to_rad(360.0 / count * i))
BulletBase.generate(ComponentManager.getBullet("SunDance"), self , weaponPos, deg_to_rad(360.0 / count * i))
elif type == 2:
for i in range(13):
for bullet in BulletBase.generate(ComponentManager.getBullet("ForeverRainbow"), self, weaponPos, 0):
for bullet in BulletBase.generate(ComponentManager.getBullet("ForeverRainbow"), self , weaponPos, 0):
bullet.rotation = 360 / 13.0 * i
elif type == 3:
if !is_instance_valid(currentFocusedBoss): return false
@@ -72,7 +72,7 @@ func attack(type):
currentInvinsible = true
playSound("attack3")
await TickTool.millseconds(500)
BulletBase.generate(ComponentManager.getBullet("BearSprint"), self, weaponPos, 0)
BulletBase.generate(ComponentManager.getBullet("BearSprint"), self , weaponPos, 0)
await trySprint()
sprintParticle.emitting = false
canRunAi = true
@@ -84,7 +84,7 @@ func attack(type):
var count = randi_range(8, 12)
for i in range(count):
if !is_instance_valid(currentFocusedBoss): return false
for bullet in BulletBase.generate(ComponentManager.getBullet("ArrowSeven"), self, findWeaponAnchor("normal"), deg_to_rad(360.0 / count * i)):
for bullet in BulletBase.generate(ComponentManager.getBullet("ArrowSeven"), self , findWeaponAnchor("normal"), deg_to_rad(360.0 / count * i)):
bullet.tracer = currentFocusedBoss
await TickTool.millseconds(830.0 / count)
return false
@@ -93,7 +93,7 @@ func attack(type):
var count = randi_range(20, 30)
for i in range(count):
if !is_instance_valid(currentFocusedBoss): return false
for bullet in BulletBase.generate(ComponentManager.getBullet("LightGun"), self, currentFocusedBoss.position, 0):
for bullet in BulletBase.generate(ComponentManager.getBullet("LightGun"), self , currentFocusedBoss.position, 0):
bullet.rotation = deg_to_rad(360.0 / count * i)
await TickTool.millseconds(1670.0 / count)
return false
@@ -101,7 +101,7 @@ func attack(type):
playSound("attack6")
for i in 16:
if !is_instance_valid(currentFocusedBoss): return false
for bullet in BulletBase.generate(ComponentManager.getBullet("LightGun"), self, currentFocusedBoss.position, 0):
for bullet in BulletBase.generate(ComponentManager.getBullet("LightGun"), self , currentFocusedBoss.position, 0):
bullet.position += MathTool.sampleInCircle(600)
bullet.look_at(currentFocusedBoss.position + MathTool.sampleInCircle(50))
await TickTool.millseconds(100)
@@ -113,7 +113,7 @@ func attack(type):
if !is_instance_valid(currentFocusedBoss): return false
playSound("attack7")
for i in 16:
for bullet in BulletBase.generate(ComponentManager.getBullet("LightGun"), self, currentFocusedBoss.position, 0):
for bullet in BulletBase.generate(ComponentManager.getBullet("LightGun"), self , currentFocusedBoss.position, 0):
bullet.rotation_degrees += initAngle
bullet.rotation -= angle / 2
bullet.rotation += angle / 16 * i
+18 -9
View File
@@ -5,23 +5,32 @@ func register():
fields[FieldStore.Entity.MAX_HEALTH] = 400
fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.9
attackCooldownMap[0] = 2000
attackCooldownMap[1] = 250
attackCooldownMap[1] = 750
attackCooldownMap[2] = 450
sprintMultiplier = 5
func spawn():
texture.play("walk")
func ai():
PresetEntityAI.follow(self, currentFocusedBoss)
tryAttack(0)
tryAttack(1)
PresetEntityAI.follow(self , currentFocusedBoss)
for i in 3:
tryAttack(i)
func attack(type: int):
if type == 0:
trySprint()
elif type == 1:
BulletBase.generate(ComponentManager.getBullet("MTYSprint"), self, position, 0)
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 target = BulletTool.findClosetBulletCanDamage(position, get_tree(), self)
var track = getTrackingAnchor()
var target = BulletTool.findClosetBulletCanDamage(track, get_tree(), self , 300)
if is_instance_valid(target):
if position.distance_to(target.position) <= 200:
var dir = (target.position - position).rotated(MathTool.randomChoiceFrom([-1, 1]) * deg_to_rad(90))
move(dir.normalized() * sprintMultiplier, true)
var dir = (target.position - track).rotated(MathTool.randomChoiceFrom([-1, 1]) * deg_to_rad(90))
move(dir.normalized() * sprintMultiplier, true)