mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-04 02:37:12 +08:00
feat(ShaderStage): 将基类从CanvasItem改为Node2D并添加类名
feat(LightGun): 添加长度属性和粒子发射控制 refactor(TickTool): 修改millseconds参数类型并添加动画关键帧修改功能 feat(Bear): 添加新攻击类型6并优化攻击5的子弹生成逻辑
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
extends BulletBase
|
||||
|
||||
@export var allColor: GradientTexture1D = null
|
||||
@export var length: float = 1000
|
||||
|
||||
@onready var track: Node2D = $"%track"
|
||||
@onready var track: ShaderStage = $"%track"
|
||||
@onready var sword: Sprite2D = $"%sword"
|
||||
@onready var points: GPUParticles2D = $"%points"
|
||||
|
||||
@@ -16,7 +17,14 @@ func spawn():
|
||||
track.material = track.material.duplicate()
|
||||
points.process_material = points.process_material.duplicate()
|
||||
setColor(myColor)
|
||||
track.size.x = length
|
||||
TickTool.modifyAnimationKey(animator, "spawn", "sword:position:x", Animation.TrackType.TYPE_BEZIER, 2.5, length / -2)
|
||||
TickTool.modifyAnimationKey(animator, "spawn", "sword:position:x", Animation.TrackType.TYPE_BEZIER, 3, length / 2)
|
||||
TickTool.modifyAnimationKey(animator, "spawn", "%hitbox:position:x", Animation.TrackType.TYPE_BEZIER, 2.5, length / -2)
|
||||
TickTool.modifyAnimationKey(animator, "spawn", "%hitbox:position:x", Animation.TrackType.TYPE_BEZIER, 3, length / 2)
|
||||
await TickTool.millseconds(2500)
|
||||
points.emitting = true
|
||||
func setColor(color: Color):
|
||||
track.material.set_shader_parameter("color", color)
|
||||
sword.modulate = color
|
||||
points.process_material.color = color
|
||||
points.process_material.color = color
|
||||
@@ -12,6 +12,7 @@ func register():
|
||||
attackCooldownMap[3] = 13000
|
||||
attackCooldownMap[4] = 4500
|
||||
attackCooldownMap[5] = 5500
|
||||
attackCooldownMap[6] = 10000
|
||||
sprintMultiplier = 60
|
||||
func spawn():
|
||||
texture.play("walk")
|
||||
@@ -19,7 +20,6 @@ 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:
|
||||
@@ -60,14 +60,22 @@ func attack(type):
|
||||
await TickTool.millseconds(830.0 / count)
|
||||
return false
|
||||
elif type == 5:
|
||||
playSound("attack5")
|
||||
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)
|
||||
bullet.rotation = deg_to_rad(360.0 / count * i)
|
||||
await TickTool.millseconds(1670.0 / count)
|
||||
return false
|
||||
elif type == 6:
|
||||
playSound("attack6")
|
||||
for i in 16:
|
||||
for bullet in BulletBase.generate(preload("res://components/Bullets/BossAttack/Bear/LightGun.tscn"), self, currentFocusedBoss.position, 0):
|
||||
bullet.position += MathTool.randv2_range(300)
|
||||
bullet.look_at(currentFocusedBoss.position)
|
||||
await TickTool.millseconds(100)
|
||||
return false
|
||||
return true
|
||||
func sprint():
|
||||
move(Vector2(sign((currentFocusedBoss.position - position).x * sprintMultiplier), 0), true)
|
||||
|
||||
Reference in New Issue
Block a user