1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00

feat(战斗系统): 添加实体惯性系统并改进击退效果

为实体添加惯性系统,包括inertia属性和impluse方法
修改Parrier子弹碰撞时的击退逻辑,使用平方根计算更真实的冲击效果
调整Wave测试数据,在非发布版本使用测试Boss数据
This commit is contained in:
2026-03-23 22:27:09 +08:00
parent 54d3783306
commit d9078f8cbd
3 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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,
+5
View File
@@ -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()