mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
fix(特效): 修复格挡特效的旋转和纹理锁定问题
调整格挡特效的旋转角度计算,使其正确朝向子弹方向 添加lockTexture属性防止特效纹理旋转 优化粒子效果和动画播放顺序
This commit is contained in:
@@ -26,11 +26,12 @@ func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞
|
||||
# 生成格挡特效
|
||||
var eff = EffectController.create(ComponentManager.getEffect("Parry"), position + (bullet.position - position).normalized() * 200) # 从子弹位置,面向其他子弹的方向前进150
|
||||
eff.modulate = bullet.modulate.blend(bullet.texture.modulate)
|
||||
eff.rotation = position.angle_to_point(bullet.position)
|
||||
eff.shot()
|
||||
# 摧毁其他子弹
|
||||
bullet.tryDestroy()
|
||||
var cycler = launcher.getOrCreateCycleTimer("parry", 2000, 100)
|
||||
if len(cycler.bullets) < maxBallCount: # 玩家最多只能拥有5点气
|
||||
if len(cycler.bullets) < maxBallCount: # 玩家最多只能拥有多少气
|
||||
for b in BulletBase.generate(
|
||||
ComponentManager.getBullet("ParryBall"), # 生成气的子弹
|
||||
launcher,
|
||||
|
||||
@@ -5,6 +5,7 @@ class_name EffectController
|
||||
@export var spawnSound: String = ""
|
||||
@export var spawnAnimation: String = ""
|
||||
@export var spawnTexture: String = ""
|
||||
@export var lockTexture: bool = false
|
||||
|
||||
@onready var particles: GPUParticles2D = $"%particles"
|
||||
@onready var sounds: Node2D = $"%sounds"
|
||||
@@ -15,6 +16,9 @@ func _ready():
|
||||
register()
|
||||
particles.emitting = false
|
||||
particles.one_shot = oneShot
|
||||
func _physics_process(_delta):
|
||||
if lockTexture:
|
||||
texture.global_rotation = 0
|
||||
func shot():
|
||||
var childParticle = particles.duplicate() as GPUParticles2D
|
||||
childParticle.emitting = true
|
||||
@@ -27,13 +31,13 @@ func shot():
|
||||
if spawnTexture:
|
||||
texture.play(spawnTexture)
|
||||
if oneShot:
|
||||
if childParticle.emitting:
|
||||
await childParticle.finished
|
||||
childParticle.queue_free()
|
||||
if spawnTexture:
|
||||
if texture.is_playing():
|
||||
await texture.animation_finished
|
||||
texture.hide()
|
||||
if childParticle.emitting:
|
||||
await childParticle.finished
|
||||
childParticle.queue_free()
|
||||
if spawnSound:
|
||||
if sound.playing:
|
||||
await sound.finished
|
||||
|
||||
Reference in New Issue
Block a user