princesse/mort: gestion avancée de la mort

Lorsque la princesse meurt, une animation de mort est lancée qui la fait
disparaitre dans un tourbillon de la mort. A la fin du tourbillon de la
mort, un signal est renvoyé à la princesse pour que la scene redémarre.

Basique mais fait le taff!
This commit is contained in:
Thomas Lavocat
2023-05-01 12:54:00 +02:00
parent c8eae91233
commit 5288ca99e4
2 changed files with 67 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=31 format=3 uid="uid://dv0mokf4eogm7"]
[gd_scene load_steps=33 format=3 uid="uid://dv0mokf4eogm7"]
[ext_resource type="Script" path="res://princesse.gd" id="1_dkp7s"]
[ext_resource type="Texture2D" uid="uid://dr7fyh2rufsyj" path="res://sprite/princess_falling_direction.png" id="2_hholp"]
@@ -199,6 +199,39 @@ animations = [{
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_6r7th"]
height = 52.0
[sub_resource type="Animation" id="Animation_uo4aj"]
resource_name = "death"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("AnimatedSprite2D:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.1, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.0, 31.4159]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("AnimatedSprite2D:scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.1, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(1, 1), Vector2(0, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hxxp0"]
_data = {
"death": SubResource("Animation_uo4aj")
}
[node name="Princesse" type="CharacterBody2D"]
collision_mask = 113
slide_on_ceiling = false
@@ -234,4 +267,11 @@ shape = SubResource("CapsuleShape2D_6r7th")
target_position = Vector2(0, 38)
collision_mask = 16
[node name="Death player" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_hxxp0")
}
[connection signal="cheese_collected" from="." to="." method="reload_fart"]
[connection signal="animation_finished" from="Death player" to="." method="_on_death_player_animation_finished"]
[connection signal="animation_finished" from="Death player" to="." method="reload_scene"]