mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-01 08:51:53 +08:00
feat(角色): 为熊角色添加新的光枪攻击技能
添加新的光枪攻击类型(类型5),包括: - 新增光枪子弹预制体及脚本 - 添加光枪音效资源 - 在熊角色中实现光枪攻击逻辑 - 新增光枪轨迹着色器 - 配置攻击冷却时间为5500ms 光枪攻击会发射10-15发彩色追踪子弹,形成环绕效果
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
extends BulletBase
|
||||
|
||||
@export var allColor: GradientTexture1D = null
|
||||
|
||||
@onready var track: Node2D = $"%track"
|
||||
@onready var sword: Sprite2D = $"%sword"
|
||||
@onready var points: GPUParticles2D = $"%points"
|
||||
|
||||
var myColor: Color
|
||||
func register():
|
||||
speed = 1
|
||||
damage = 5
|
||||
penerate = 1
|
||||
func spawn():
|
||||
myColor = allColor.gradient.sample(randf())
|
||||
track.material = track.material.duplicate()
|
||||
points.process_material = points.process_material.duplicate()
|
||||
setColor(myColor)
|
||||
func setColor(color: Color):
|
||||
track.material.set_shader_parameter("color", color)
|
||||
sword.modulate = color
|
||||
points.process_material.color = color
|
||||
@@ -11,6 +11,7 @@ func register():
|
||||
attackCooldownMap[2] = 8000
|
||||
attackCooldownMap[3] = 13000
|
||||
attackCooldownMap[4] = 4500
|
||||
attackCooldownMap[5] = 5500
|
||||
sprintMultiplier = 60
|
||||
func spawn():
|
||||
texture.play("walk")
|
||||
@@ -18,6 +19,7 @@ func ai():
|
||||
PresetEntityAI.follow(self, currentFocusedBoss, 200)
|
||||
for i in len(attackCooldownMap.keys()):
|
||||
tryAttack(i)
|
||||
# tryAttack(5)
|
||||
func attack(type):
|
||||
var weaponPos = findWeaponAnchor("normal")
|
||||
if type == 0:
|
||||
@@ -57,6 +59,15 @@ func attack(type):
|
||||
bullet.tracer = currentFocusedBoss
|
||||
await TickTool.millseconds(830.0 / count)
|
||||
return false
|
||||
elif type == 5:
|
||||
var target = currentFocusedBoss.position
|
||||
var count = randi_range(10, 15)
|
||||
for i in range(count):
|
||||
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/LightGun.tscn"), self, target, 0):
|
||||
bullet.position += Vector2.from_angle(deg_to_rad(360.0 / count * i)) * 1000
|
||||
bullet.rotation = bullet.position.angle_to_point(target)
|
||||
await TickTool.millseconds(1670.0 / count)
|
||||
return false
|
||||
return true
|
||||
func sprint():
|
||||
move(Vector2(sign((currentFocusedBoss.position - position).x * sprintMultiplier), 0), true)
|
||||
|
||||
Reference in New Issue
Block a user