+death animation bear

This commit is contained in:
2026-08-24 08:36:48 +03:00
parent e1899e49f4
commit d632670092
4 changed files with 16 additions and 14 deletions
+14 -12
View File
@@ -57,6 +57,7 @@ var _anim_stand: StringName = &"" # IDLE_standing — reared-up wind-up / ro
var _anim_swipe: StringName = &"" # ONE_TWO_HIT — double swipe
var _anim_smash: StringName = &"" # SMASH_HIT — overhead smash
var _anim_leap: StringName = &"" # JUMP_SMASH — leap slam
var _anim_death: StringName = &"" # DEATH — death
const _ACCEL_FACTOR: float = 9.0
# Hard deceleration for planted states (wind-up / recovery / neutral settle) so the bear
@@ -100,11 +101,12 @@ func _ready() -> void:
_anim_swipe = _resolve_anim(["ONE_TWO_HIT", "SMASH_HIT"])
_anim_smash = _resolve_anim(["SMASH_HIT", "ONE_TWO_HIT"])
_anim_leap = _resolve_anim(["JUMP_SMASH", "SMASH_HIT"])
_anim_death = _resolve_anim(["DEATH"])
# Loop the locomotion / idle clips; the attack clips (swipe/smash/leap) are one-shot,
# so their on-ground settle frames play once and then hold instead of looping.
for a in [_anim_idle, _anim_run, _anim_walk2, _anim_stand]:
_ensure_loop(a)
for a in [_anim_swipe, _anim_smash, _anim_leap]:
for a in [_anim_swipe, _anim_smash, _anim_leap, _anim_death]:
_set_no_loop(a)
_anim_player.playback_default_blend_time = 0.12
_hit_area.body_entered.connect(_on_body_entered)
@@ -735,19 +737,19 @@ func _die(hit_dir: Vector3) -> void:
_hit_area.monitoring = false
velocity = Vector3.ZERO
_blood_burst.burst(global_position + Vector3(0.0, 1.4, 0.0), hit_dir)
_play(_anim_idle)
_play(_anim_death)
# No death clip on the rig — topple the beast onto its side (about the hit direction,
# so it falls the way it was struck) and sink it away, then free.
var fall_axis := Vector3(-hit_dir.z, 0.0, hit_dir.x)
if fall_axis.length() < 0.01:
fall_axis = Vector3.RIGHT
var tween := create_tween()
tween.tween_property(_mesh, "rotation",
_mesh.rotation + fall_axis.normalized() * deg_to_rad(88.0), 0.7)\
.set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_IN)
tween.tween_interval(2.5)
tween.tween_property(_mesh, "position:y", _mesh.position.y - 3.0, 1.0)
tween.tween_callback(queue_free)
#var fall_axis := Vector3(-hit_dir.z, 0.0, hit_dir.x)
#if fall_axis.length() < 0.01:
# fall_axis = Vector3.RIGHT
#var tween := create_tween()
#tween.tween_property(_mesh, "rotation",
# _mesh.rotation + fall_axis.normalized() * deg_to_rad(88.0), 0.7)\
# .set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_IN)
#tween.tween_interval(2.5)
#tween.tween_property(_mesh, "position:y", _mesh.position.y - 3.0, 1.0)
#tween.tween_callback(queue_free)
# ── Interface shared with the matador (guarded elsewhere via has_method) ─────────────