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

feat(角色): 添加狗角色音效和攻击冷却随机化

添加狗角色的受伤音效文件并配置导入设置
修改狗的攻击冷却时间为3000-5000毫秒随机值
调整狗角色的受伤音效播放几率为30%
为狗角色添加碰撞检测形状
This commit is contained in:
2025-11-16 14:42:48 +08:00
parent 9e77b720d6
commit b7638fa9b6
9 changed files with 96 additions and 3 deletions
+3 -1
View File
@@ -77,6 +77,7 @@ var inventoryMax = {
@export var level: int = 1
@export var currentInvinsible: bool = false
@export var useStatic: bool = false
@export var hurtAudioRate: float = 1
@onready var animatree: AnimationTree = $"%animatree"
@onready var texture: AnimatedSprite2D = $"%texture"
@@ -239,7 +240,8 @@ func takeDamage(bullet: BulletBase, crit: bool):
storeEnergy(damage * 0.35)
damage = 0
else:
playSound("hurt")
if MathTool.rate(hurtAudioRate):
playSound("hurt")
storeEnergy(damage * -0.5)
position += Vector2.from_angle(bullet.position.angle_to_point(position)) * bullet.knockback
hit.emit(damage, bullet, crit)