sword holster, health

This commit is contained in:
2026-06-24 23:11:19 +03:00
parent 64124990a6
commit 115872b98f
7 changed files with 541 additions and 62 deletions
+10 -1
View File
@@ -34,6 +34,10 @@ var _bull_anim: AnimationPlayer = null
var _charge_ready_emitter: CPUParticles3D = null
var _slam_pending: bool = false
const MAX_HEALTH: int = 10
var health: int = MAX_HEALTH
signal health_changed(new_health: int)
var _huff_player: AudioStreamPlayer = null
var _crowd_player: AudioStreamPlayer = null
var _huff_timer: float = 0.0
@@ -660,7 +664,7 @@ func _physics_process(delta: float) -> void:
var flat_n := Vector3(normal.x, 0.0, normal.z).normalized()
var into_spd := -pre_wall_vel.dot(flat_n)
var exit_spd := maxf(into_spd * DP.f("wall_bounce_restitution"),
DP.f("wall_min_bounce_speed"))
DP.f("wall_min_bounce_speed"))
velocity.x = flat_n.x * exit_spd
velocity.z = flat_n.z * exit_spd
pre_wall_vel = Vector3(velocity.x, 0.0, velocity.z)
@@ -693,3 +697,8 @@ func _physics_process(delta: float) -> void:
_set_dust_state(DustState.NONE)
# ── Hoof sounds ───────────────────────────────────────────────────────────
func take_sword_hit() -> void:
health = maxi(0, health - 1)
health_changed.emit(health)