From d9078f8cbd2f4ce3dfe62436d1f2276003539e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=A8=E8=90=BD=E5=9F=BA=E5=9B=B4=E8=99=BE?= <3161880837@qq.com> Date: Mon, 23 Mar 2026 22:27:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=88=98=E6=96=97=E7=B3=BB=E7=BB=9F):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=9E=E4=BD=93=E6=83=AF=E6=80=A7=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E5=B9=B6=E6=94=B9=E8=BF=9B=E5=87=BB=E9=80=80=E6=95=88?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为实体添加惯性系统,包括inertia属性和impluse方法 修改Parrier子弹碰撞时的击退逻辑,使用平方根计算更真实的冲击效果 调整Wave测试数据,在非发布版本使用测试Boss数据 --- scripts/Contents/Bullets/Parrier.gd | 2 +- scripts/Contents/Wave.gd | 2 +- scripts/Statemachine/EntityBase.gd | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/Contents/Bullets/Parrier.gd b/scripts/Contents/Bullets/Parrier.gd index dc7f90d..0b96dba 100644 --- a/scripts/Contents/Bullets/Parrier.gd +++ b/scripts/Contents/Bullets/Parrier.gd @@ -29,7 +29,7 @@ func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞 eff.rotation = position.angle_to_point(bullet.position) eff.shot() CameraManager.shake(200, 250) - launcher.position -= (bullet.position - position).normalized() * 50 + launcher.impluse((position - bullet.position).normalized() * sqrt(bullet.speed) * 500) # 摧毁其他子弹 bullet.tryDestroy() var cycler = launcher.getOrCreateCycleTimer("parry", 2000, 100) diff --git a/scripts/Contents/Wave.gd b/scripts/Contents/Wave.gd index 9b79214..b3b5ef9 100644 --- a/scripts/Contents/Wave.gd +++ b/scripts/Contents/Wave.gd @@ -50,7 +50,7 @@ static var WAVE_JUSTJOKE = [ Wave.create("Kernyr", 0, 0, true, 0, INF, 1), ] static var WAVE_EMPTY = [] -static var data = WAVE_NORMAL if WorldManager.isRelease() else WAVE_NORMAL +static var data = WAVE_NORMAL if WorldManager.isRelease() else WAVE_TESTBOSS_KUKE static func create( entity_: String, diff --git a/scripts/Statemachine/EntityBase.gd b/scripts/Statemachine/EntityBase.gd index 37a39b2..5047abe 100644 --- a/scripts/Statemachine/EntityBase.gd +++ b/scripts/Statemachine/EntityBase.gd @@ -113,6 +113,7 @@ var canRunAi: bool = true var currentStage: int = 0 var spawnTime: float = 0 var cycleTimers: Dictionary = {} +var inertia: Vector2 = Vector2.ZERO func _ready(): if useStatic: @@ -197,6 +198,8 @@ func _physics_process(_delta: float) -> void: ai() elif isSummon(): ai() + velocity += inertia + inertia *= 0.9 move_and_slide() storeEnergy(randf_range(0.01, 0.05 + fields.get(FieldStore.Entity.ENERGY_REGENERATION) - 1), true) trailParticle.emitting = trailing @@ -205,6 +208,8 @@ func _physics_process(_delta: float) -> void: cycler.apply() # 通用方法 +func impluse(force: Vector2): + inertia += force func getOrCreateCycleTimer(timerName: String, period: float = 1000, distance: float = 200, start: bool = true) -> CycleTimer: if !cycleTimers.has(timerName): var newTimer = CycleTimer.new()