mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat(武器系统): 添加魔法导弹武器及配套子弹逻辑
实现魔法导弹武器系统,包括: 1. 新增HOLD_LOOP发射类型武器 2. 添加魔法导弹子弹类实现追踪和分裂逻辑 3. 修改武器基类支持循环攻击模式 4. 更新角色控制器支持新武器类型 5. 添加相关资源文件和配置
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
extends BulletBase
|
||||
class_name MagicMissleBullet
|
||||
|
||||
var powerScale: int = 3
|
||||
var speedV2: Vector2 = Vector2.ZERO
|
||||
var accelerating: bool = true
|
||||
var roundBullets: Array[MagicMissleBullet]
|
||||
|
||||
func ai():
|
||||
if accelerating:
|
||||
rotation = lerp_angle(rotation, position.angle_to_point(get_global_mouse_position()), 0.1)
|
||||
speedV2 += (get_global_mouse_position() - position).normalized() * 1
|
||||
elif speed < 1:
|
||||
tryDestroy()
|
||||
speedV2 *= 0.995
|
||||
speed = speedV2.length()
|
||||
PresetBulletAI.forward(self , speedV2.angle())
|
||||
|
||||
func succeedToHit(_dmg: float, entity: EntityBase):
|
||||
if powerScale > 0 && accelerating && roundBullets.count(self ) > 0:
|
||||
for i in randi_range(1, powerScale):
|
||||
for bullet in BulletBase.generate(
|
||||
ComponentManager.getBullet("MagicMissle"),
|
||||
launcher,
|
||||
position,
|
||||
entity.position.angle_to_point(position) + PI + randf_range(-1, 1) * deg_to_rad(60)
|
||||
):
|
||||
if bullet is MagicMissleBullet:
|
||||
bullet.position += Vector2.from_angle(bullet.rotation) * 100
|
||||
bullet.speedV2 += Vector2.from_angle(bullet.rotation) * 30
|
||||
bullet.roundBullets = roundBullets
|
||||
bullet.powerScale = powerScale - 1
|
||||
roundBullets.append(bullet)
|
||||
powerScale = 0
|
||||
@@ -0,0 +1 @@
|
||||
uid://b1y8r5xrhhso
|
||||
Reference in New Issue
Block a user