diff --git a/graphics/player/sg_respawn.png b/graphics/player/sg_respawn.png new file mode 100644 index 0000000..35ca9b1 Binary files /dev/null and b/graphics/player/sg_respawn.png differ diff --git a/graphics/player/sg_respawn.png.import b/graphics/player/sg_respawn.png.import new file mode 100644 index 0000000..6083c74 --- /dev/null +++ b/graphics/player/sg_respawn.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/sg_respawn.png-83125dc5d93640f1f36a4388495f77b6.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://graphics/player/sg_respawn.png" +dest_files=[ "res://.import/sg_respawn.png-83125dc5d93640f1f36a4388495f77b6.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/objects/player/player.gd b/objects/player/player.gd index cf61e36..3fb1ca7 100644 --- a/objects/player/player.gd +++ b/objects/player/player.gd @@ -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") diff --git a/objects/player/player.tscn b/objects/player/player.tscn index 6da76fb..fa3ec55 100644 --- a/objects/player/player.tscn +++ b/objects/player/player.tscn @@ -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"]