fix softlock with respawn animation

This commit is contained in:
Haze Weathers 2023-11-26 17:45:30 -05:00
parent cd444e84c1
commit e5b4fa05b0
2 changed files with 20 additions and 12 deletions

View file

@ -314,12 +314,12 @@ func _on_Drowning_state_entered() -> void:
animation_player.call_deferred("play", "drown")
func _on_Respawn_state_entered() -> void:
animation_player.play("respawn")
global_position = Game.respawn_point
graphics.visible = true
func _on_Respawn_state_exited() -> void:
pass
func _on_Appearing_state_entered() -> void:
global_position = Game.respawn_point
animation_player.play("respawn")
func _on_Edge_state_entered():
animation_player.play("edge")
@ -531,8 +531,3 @@ func _on_OxygenTimer_timeout():
#Reset low oxygen effect when leaving level
func _on_Player_tree_exited():
set_underwater_audio(false)
func _on_animation_finished(anim_name: String) -> void:
if anim_name == "respawn":
state_chart.send_event("get_real")

View file

@ -1235,7 +1235,7 @@ initial_state = NodePath("Grounded")
[node name="On Died" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource( 10 )
to = NodePath("../Inactive")
to = NodePath("../Appearing")
event = "died"
[node name="On StartTeleport" type="Node" parent="StateChart/Root/Movement"]
@ -1527,6 +1527,11 @@ script = ExtResource( 10 )
to = NodePath("../../Grounded")
event = "get_real"
[node name="On Appear" type="Node" parent="StateChart/Root/Movement/Inactive"]
script = ExtResource( 10 )
to = NodePath("../../Appearing")
event = "appear"
[node name="Teleporting" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource( 11 )
__meta__ = {
@ -1538,6 +1543,14 @@ script = ExtResource( 10 )
to = NodePath("../../Grounded")
event = "get_real"
[node name="Appearing" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource( 11 )
[node name="On Delay" type="Node" parent="StateChart/Root/Movement/Appearing"]
script = ExtResource( 10 )
to = NodePath("../../Grounded")
delay = 0.4
[node name="Health" type="Node" parent="StateChart/Root"]
script = ExtResource( 9 )
initial_state = NodePath("Vulnerable")
@ -1611,7 +1624,6 @@ script = ExtResource( 11 )
layer = 128
[node name="StateChartDebug" type="Tree" parent="StateDebugLayer"]
visible = false
anchor_left = 1.0
anchor_right = 1.0
margin_left = -147.0
@ -1641,7 +1653,6 @@ align = 1
[connection signal="tree_exited" from="." to="." method="_on_Player_tree_exited"]
[connection signal="body_entered" from="Hitbox" to="." method="_on_Hitbox_body_entered"]
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_finished"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement" to="." method="_process_movement"]
[connection signal="state_entered" from="StateChart/Root/Movement/Grounded" to="." method="_on_Grounded_state_entered"]
[connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded" to="." method="_process_grounded"]
@ -1683,8 +1694,10 @@ align = 1
[connection signal="state_entered" from="StateChart/Root/Movement/Teleporting" to="." method="_on_Inactive_state_entered"]
[connection signal="state_entered" from="StateChart/Root/Movement/Teleporting" to="." method="_on_Teleporting_state_entered"]
[connection signal="state_exited" from="StateChart/Root/Movement/Teleporting" to="." method="_on_Inactive_state_exited"]
[connection signal="state_entered" from="StateChart/Root/Movement/Appearing" to="." method="_on_Inactive_state_entered"]
[connection signal="state_entered" from="StateChart/Root/Movement/Appearing" to="." method="_on_Appearing_state_entered"]
[connection signal="state_exited" from="StateChart/Root/Movement/Appearing" to="." method="_on_Inactive_state_exited"]
[connection signal="state_entered" from="StateChart/Root/Health/Respawn" to="." method="_on_Respawn_state_entered"]
[connection signal="state_exited" from="StateChart/Root/Health/Respawn" to="." method="_on_Respawn_state_exited"]
[connection signal="state_entered" from="StateChart/Root/Health/Dead" to="." method="_on_Dead_state_entered"]
[connection signal="state_entered" from="StateChart/Root/Health/Drowning" to="." method="_on_Drowning_state_entered"]
[connection signal="state_exited" from="StateChart/Root/Health/Drowning" to="." method="_on_Drowning_state_exited"]