mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat(武器): 增强格挡武器并添加新特效
增加格挡武器的攻击力从20提升至35 添加冲刺速度随气力增加的机制 为格挡和攻击添加新的视觉特效和音效 调整格挡子弹的碰撞检测形状 优化特效控制器逻辑确保正确释放资源
This commit is contained in:
@@ -8,12 +8,23 @@ var maxParryTimes: int = 1
|
||||
var maxBallCount: int = 3
|
||||
var atk: float = 0
|
||||
|
||||
func spawn():
|
||||
var varians = randi_range(0, 1)
|
||||
var inverts = []
|
||||
var frames = load("res://resources/effects/parrier/%d/%d.tres" % [varians, varians])
|
||||
var eff = EffectController.create(ComponentManager.getEffect("Parrier"), position)
|
||||
eff.rotation = rotation
|
||||
eff.scale.y *= MathTool.randomChoiceFrom([-1, 1])
|
||||
if varians in inverts:
|
||||
eff.scale.x *= -1
|
||||
eff.texture.sprite_frames = frames
|
||||
eff.shot()
|
||||
func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞
|
||||
if BulletTool.canDamage(bullet, launcher): # 其他子弹可以使当前子弹的发射者受伤吗?
|
||||
if parryiedTimes < maxParryTimes && MathTool.rate(parryRate): # 一个刀光最多格挡多少个敌方子弹?
|
||||
parryiedTimes += 1
|
||||
# 生成格挡特效
|
||||
var eff = EffectController.create(ComponentManager.getEffect("Parry"), position + (bullet.position - position).normalized() * 150) # 从子弹位置,面向其他子弹的方向前进150
|
||||
var eff = EffectController.create(ComponentManager.getEffect("Parry"), position + (bullet.position - position).normalized() * 200) # 从子弹位置,面向其他子弹的方向前进150
|
||||
eff.modulate = bullet.modulate.blend(bullet.texture.modulate)
|
||||
eff.shot()
|
||||
# 摧毁其他子弹
|
||||
|
||||
@@ -10,8 +10,8 @@ func attack(entity: EntityBase):
|
||||
for bullet in BulletBase.generate(
|
||||
ComponentManager.getBullet("Parrier"),
|
||||
entity,
|
||||
entity.findWeaponAnchor("normal"),
|
||||
entity.findWeaponAnchor("normal").angle_to_point(get_global_mouse_position()),
|
||||
entity.texture.global_position,
|
||||
entity.texture.global_position.angle_to_point(get_global_mouse_position()),
|
||||
):
|
||||
if bullet is ParrierBullet:
|
||||
bullet.atk = readStore("atk")
|
||||
|
||||
@@ -15,6 +15,10 @@ func _ready():
|
||||
register()
|
||||
particles.emitting = false
|
||||
particles.one_shot = oneShot
|
||||
func shot():
|
||||
var childParticle = particles.duplicate() as GPUParticles2D
|
||||
childParticle.emitting = true
|
||||
add_child(childParticle)
|
||||
var sound = sounds.get_node_or_null(spawnSound)
|
||||
if sound and sound.stream:
|
||||
sound.play()
|
||||
@@ -22,23 +26,20 @@ func _ready():
|
||||
animator.play(spawnAnimation)
|
||||
if spawnTexture:
|
||||
texture.play(spawnTexture)
|
||||
func shot():
|
||||
var childParticle = particles.duplicate() as GPUParticles2D
|
||||
childParticle.emitting = true
|
||||
add_child(childParticle)
|
||||
if oneShot:
|
||||
await childParticle.finished
|
||||
childParticle.queue_free()
|
||||
if childParticle.emitting:
|
||||
await childParticle.finished
|
||||
childParticle.queue_free()
|
||||
if spawnTexture:
|
||||
if texture.is_playing():
|
||||
await texture.animation_finished
|
||||
texture.hide()
|
||||
if spawnSound:
|
||||
var sound: AudioStreamPlayer2D = sounds.get_node(spawnSound)
|
||||
if sound.playing:
|
||||
await sound.finished
|
||||
if spawnAnimation:
|
||||
if animator.is_playing():
|
||||
await animator.animation_finished
|
||||
if spawnTexture:
|
||||
if texture.is_playing():
|
||||
await texture.animation_finished
|
||||
queue_free()
|
||||
|
||||
func register():
|
||||
|
||||
Reference in New Issue
Block a user