1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00

feat: 添加新的角色Hen,更新Chick角色的攻击逻辑,增强Boss状态条和子弹功能

This commit is contained in:
2025-08-26 14:47:12 +08:00
parent 5923660195
commit 51b3359e8d
11 changed files with 59 additions and 15 deletions
+6
View File
@@ -0,0 +1,6 @@
extends BulletBase
class_name Diamond
func ai():
rotation_degrees += 1
forward(Vector2.from_angle(rotation))
+11
View File
@@ -1,6 +1,17 @@
extends EntityBase
class_name Chick
var angle = 0
func _ready():
fields[FieldStore.Entity.MAX_HEALTH] = 1000
fields[FieldStore.Entity.MOVEMENT_SPEED] = 0.25
super._ready()
func ai():
move(currentFocusedBoss.position - position)
if tryAttack(0):
angle += 20
func attack(type):
if type == 0:
var weaponPos = findWeaponAnchor("normal")
BulletBase.generate(preload("res://components/Bullets/Diamond.tscn"), self, weaponPos, deg_to_rad(angle))
+1 -1
View File
@@ -22,4 +22,4 @@ func sprint():
move(Vector2(
Input.get_axis("m_left", "m_right"),
Input.get_axis("m_up", "m_down")
) * 6, true)
) * 8, true)
+1 -1
View File
@@ -6,6 +6,6 @@ class_name BossBar
func _process(delta):
super._process(delta)
if entity:
if is_instance_valid(entity):
nameLabel.text = entity.displayName
valueLabel.text = "%.2f" % (entity.health / entity.fields[FieldStore.Entity.MAX_HEALTH] * 100)
+1 -1
View File
@@ -31,7 +31,7 @@ func hit(target: Node):
var entity: EntityBase = EntityTool.fromHurtbox(target)
if !entity || !launcher: return
if entity == launcher: return
if GameRule.allowFriendlyFire:
if !GameRule.allowFriendlyFire:
if entity.isPlayer() == launcher.isPlayer(): return
entity.takeDamage(self, MathTool.rate(launcher.fields.get(FieldStore.Entity.CRIT_RATE)))
if !MathTool.rate(fullPenerate()):
+7 -2
View File
@@ -30,6 +30,8 @@ var sprinting: bool = false
func _ready():
health = fields.get(FieldStore.Entity.MAX_HEALTH)
statebar.visible = !isBoss
if !isPlayer():
currentFocusedBoss = get_tree().get_nodes_in_group("players")[0]
func _process(_delta):
health = clamp(health, 0, fields.get(FieldStore.Entity.MAX_HEALTH))
animatree.set("parameters/blend_position", lerpf(animatree.get("parameters/blend_position"), lastDirection, 0.1))
@@ -40,7 +42,8 @@ func _physics_process(_delta: float) -> void:
sprinting = false
else:
velocity = Vector2.ZERO
ai()
if isPlayer() or is_instance_valid(currentFocusedBoss):
ai()
move_and_slide()
# 通用方法
@@ -70,8 +73,10 @@ func startCooldown():
lastAttack = Time.get_ticks_msec()
return state
func tryAttack(type: int):
if startCooldown():
var state = startCooldown()
if state:
attack(type)
return state
func trySprint():
sprint()
sprinting = true
+1 -1
View File
@@ -6,6 +6,6 @@ class_name EntityStateBar
@onready var healthBar: ColorBar = $"%health"
func _process(_delta):
if entity:
if is_instance_valid(entity):
healthBar.maxValue = entity.fields.get(FieldStore.Entity.MAX_HEALTH)
healthBar.setCurrent(entity.health)