fixed finally webrtc
This commit is contained in:
@@ -243,7 +243,7 @@ func _update_animation(delta):
|
||||
sprite.frame = frame_index
|
||||
anim_frame = frame_index # Keep anim_frame updated for compatibility
|
||||
|
||||
func _on_take_damage():
|
||||
func _on_take_damage(_attacker_position: Vector2 = Vector2.ZERO):
|
||||
# Play damage animation
|
||||
state = SlimeState.DAMAGED
|
||||
state_timer = 0.3
|
||||
@@ -268,6 +268,15 @@ func _update_client_visuals():
|
||||
# Update visuals on clients based on synced state
|
||||
super._update_client_visuals()
|
||||
|
||||
# CRITICAL: If dead, always show DIE animation (don't let state override it)
|
||||
# This prevents DAMAGED state from showing DAMAGE animation after death sync
|
||||
if is_dead:
|
||||
_set_animation("DIE")
|
||||
_update_animation(0.0)
|
||||
if sprite:
|
||||
sprite.frame = anim_frame
|
||||
return
|
||||
|
||||
# Map synced state to animation (similar to how bat/rat use state directly)
|
||||
match state:
|
||||
SlimeState.IDLE:
|
||||
|
||||
Reference in New Issue
Block a user