mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
feat(子弹系统): 添加扫帚系列子弹及相关资源
添加扫帚子弹、扫帚炮和扫帚回旋镖三种新子弹类型 包含子弹脚本、音效、动画和特效资源 修改EnergyBlock实体以支持新子弹的攻击逻辑 更新子弹基类添加销毁信号
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
extends BulletBase
|
||||
class_name BroomBullet
|
||||
|
||||
func ai():
|
||||
PresetBulletAI.lockLauncher(self , launcher, true)
|
||||
@@ -0,0 +1 @@
|
||||
uid://b7bstudbunlxr
|
||||
@@ -0,0 +1,8 @@
|
||||
extends BulletBase
|
||||
class_name BroomBoomerangBullet
|
||||
|
||||
func ai():
|
||||
PresetBulletAI.forward(self , rotation)
|
||||
speed -= 0.5
|
||||
if speed < 0 && position.distance_to(launcher.position) < 100:
|
||||
tryDestroy()
|
||||
@@ -0,0 +1 @@
|
||||
uid://k63hoju1eyd
|
||||
@@ -0,0 +1,7 @@
|
||||
extends BulletBase
|
||||
class_name BroomGun
|
||||
|
||||
func shake():
|
||||
CameraManager.shake(2000, 200)
|
||||
func ai():
|
||||
PresetBulletAI.trace(self , launcher.currentFocusedPosition, 0.05)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cuu5b0gibd054
|
||||
@@ -1,28 +1,57 @@
|
||||
extends EntityBase
|
||||
class_name EnergyBlockEntity
|
||||
|
||||
var currentBroom: BroomBullet
|
||||
|
||||
func register():
|
||||
fields[FieldStore.Entity.MAX_HEALTH] = 5000
|
||||
hit.connect(
|
||||
func(damage: float, bullet: BulletBase, _crit: bool):
|
||||
bullet.launcher.storeEnergy(damage)
|
||||
)
|
||||
fields[FieldStore.Entity.MAX_HEALTH] = 3000
|
||||
attackCooldownMap[0] = 6000
|
||||
attackCooldownMap[1] = 10000
|
||||
attackCooldownMap[2] = 4000
|
||||
attackCooldownMap[1] = 3000
|
||||
attackCooldownMap[2] = 8000
|
||||
attackCooldownMap[3] = 8000
|
||||
attackCooldownMap[4] = 3000
|
||||
attackCooldownMap[4] = 2000
|
||||
attackCooldownMap[5] = 2000
|
||||
attackCooldownMap[6] = 5000
|
||||
attackMutexes = [1, 4]
|
||||
attackMutexes = [0, 1]
|
||||
sprintMultiplier = 30
|
||||
func ai():
|
||||
for i in 7:
|
||||
tryAttack(i, [1, 3])
|
||||
PresetEntityAI.distanceAttack(self , currentFocusedBoss, 0, 300, 0)
|
||||
for i in 6:
|
||||
tryAttack(i + 1, [3])
|
||||
if 1 not in attackingStates:
|
||||
PresetEntityAI.follow(self , currentFocusedBoss)
|
||||
func attack(type: int):
|
||||
if type == 0:
|
||||
BulletBase.generate(ComponentManager.getBullet("SwingSword"), self , getTrackingAnchor(), getTrackingAnchor().angle_to_point(currentFocusedPosition))
|
||||
for bullet in BulletBase.generate(ComponentManager.getBullet("SwingSword"), self , getTrackingAnchor(), getTrackingAnchor().angle_to_point(currentFocusedPosition)):
|
||||
if bullet is SwingSwordBullet:
|
||||
await bullet.destroied
|
||||
elif type == 1:
|
||||
for bullet in BulletBase.generate(ComponentManager.getBullet("Broom"), self , getTrackingAnchor(), getTrackingAnchor().angle_to_point(currentFocusedPosition)):
|
||||
if is_instance_valid(currentBroom): break
|
||||
if bullet is BroomBullet:
|
||||
currentBroom = bullet
|
||||
await TickTool.frame()
|
||||
bullet.animator.play("prepare")
|
||||
await bullet.animator.animation_finished
|
||||
await chargeUp()
|
||||
trySprint()
|
||||
currentBroom.animator.play("attack")
|
||||
elif type == 2:
|
||||
for i in 3:
|
||||
for bullet in BulletBase.generate(ComponentManager.getBullet("BroomGun"), self , position, position.angle_to_point(currentFocusedPosition)):
|
||||
if bullet is BulletBase:
|
||||
bullet.position += Vector2.from_angle(bullet.rotation).rotated(deg_to_rad(90)) * i * 100
|
||||
elif type == 3:
|
||||
for bullet in BulletBase.generate(ComponentManager.getBullet("Broom"), self , getTrackingAnchor(), 0):
|
||||
if bullet is BroomBullet:
|
||||
await TickTool.frame()
|
||||
bullet.animator.play("rotate")
|
||||
elif type == 4:
|
||||
BulletBase.generate(ComponentManager.getBullet("BroomBoomerang"), self , position, position.angle_to_point(currentFocusedPosition))
|
||||
elif type == 5:
|
||||
var track = getTrackingAnchor()
|
||||
var bullet = BulletTool.findClosetBulletCanDamage(track, get_tree(), self , 200)
|
||||
if is_instance_valid(bullet):
|
||||
BulletBase.generate(ComponentManager.getBullet("Parrier"), self , track, track.angle_to_point(bullet.position))
|
||||
func sprint():
|
||||
move((currentFocusedPosition - position).normalized() * sprintMultiplier, true)
|
||||
|
||||
@@ -10,6 +10,8 @@ enum MotionType {
|
||||
BREATH, # 吐息
|
||||
}
|
||||
|
||||
signal destroied(becauseMap: bool)
|
||||
|
||||
@export var displayName: String = "未知子弹"
|
||||
@export var speed: float = 10.0
|
||||
@export var baseDamage: float = 10.0
|
||||
@@ -188,6 +190,7 @@ func tryDestroy(becauseMap: bool = false):
|
||||
if autoDestroyAnimation:
|
||||
animator.play("destroy")
|
||||
await animator.animation_finished
|
||||
destroied.emit(becauseMap)
|
||||
queue_free()
|
||||
func trySplit():
|
||||
if is_instance_valid(launcher) and canDuplicateSelf:
|
||||
|
||||
Reference in New Issue
Block a user