1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-07-02 08:12:12 +08:00

feat(子弹系统): 添加SPRINT运动类型并处理碰撞逻辑

为子弹系统新增SPRINT运动类型,并在Parrier子弹中处理其碰撞逻辑。当SPRINT类型子弹碰撞时,会销毁子弹并使发射者速度反向衰减。
This commit is contained in:
2026-04-30 06:42:15 +08:00
parent 95bd4e4ebb
commit 64f11d75b2
2 changed files with 8 additions and 4 deletions
+3
View File
@@ -54,6 +54,9 @@ func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞
bullet.tryDestroy() bullet.tryDestroy()
elif bullet.motionType == BulletBase.MotionType.SWING: elif bullet.motionType == BulletBase.MotionType.SWING:
bullet.hitbox.disabled = true bullet.hitbox.disabled = true
elif bullet.motionType == BulletBase.MotionType.SPRINT:
bullet.tryDestroy()
bullet.launcher.velocity *= -0.1
elif bullet.motionType == BulletBase.MotionType.SUMMON || bullet.motionType == BulletBase.MotionType.MAGIC: elif bullet.motionType == BulletBase.MotionType.SUMMON || bullet.motionType == BulletBase.MotionType.MAGIC:
launcher.storeEnergy(sqrt(bullet.baseDamage)) launcher.storeEnergy(sqrt(bullet.baseDamage))
var cycler = launcher.getOrCreateCycleTimer("parry", 2000, 100) var cycler = launcher.getOrCreateCycleTimer("parry", 2000, 100)
+5 -4
View File
@@ -2,10 +2,11 @@ extends Area2D
class_name BulletBase class_name BulletBase
enum MotionType { enum MotionType {
SWING, SWING, # 挥舞(近战攻击)
PROJECTILE, PROJECTILE, # 射弹
MAGIC, MAGIC, # 魔法
SUMMON SUMMON, # 召唤
SPRINT, # 冲撞
} }
@export var displayName: String = "未知子弹" @export var displayName: String = "未知子弹"