respawn animation (implements #213)

This commit is contained in:
Haze Weathers 2023-11-25 18:40:39 -05:00
parent 7cc669e813
commit cb6a9e13f4
4 changed files with 90 additions and 2 deletions

View file

@ -313,9 +313,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
state_chart.call_deferred("send_event", "get_real")
func _on_Respawn_state_exited() -> void:
pass
func _on_Edge_state_entered():
animation_player.play("edge")
@ -521,3 +524,8 @@ 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

@ -1,4 +1,4 @@
[gd_scene load_steps=53 format=2]
[gd_scene load_steps=55 format=2]
[ext_resource path="res://objects/player/player.gd" type="Script" id=1]
[ext_resource path="res://graphics/player/palettes/default.png" type="Texture" id=2]
@ -28,6 +28,7 @@
[ext_resource path="res://graphics/player/sg_jump_ladder.png" type="Texture" id=26]
[ext_resource path="res://graphics/player/sg_edge.png" type="Texture" id=27]
[ext_resource path="res://graphics/player/sg_drown.png" type="Texture" id=28]
[ext_resource path="res://graphics/player/sg_respawn.png" type="Texture" id=29]
[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 3 )
@ -774,6 +775,47 @@ tracks/3/keys = {
"values": [ 0.0 ]
}
[sub_resource type="Animation" id=25]
resource_name = "respawn"
length = 0.4
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Graphics/Sprite:texture")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ ExtResource( 29 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Graphics/Sprite:hframes")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 8 ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Graphics/Sprite:frame")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ 0, 1, 2, 3, 4, 5, 6, 7 ]
}
[sub_resource type="Animation" id=11]
resource_name = "shoot_airborne"
length = 0.001
@ -1155,6 +1197,7 @@ anims/idle = SubResource( 6 )
anims/jump = SubResource( 8 )
anims/ladder_jump = SubResource( 21 )
anims/push = SubResource( 17 )
anims/respawn = SubResource( 25 )
anims/shoot_airborne = SubResource( 11 )
anims/shoot_grounded = SubResource( 10 )
anims/stim = SubResource( 19 )
@ -1586,6 +1629,7 @@ 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"]
@ -1628,6 +1672,7 @@ align = 1
[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/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"]