add enemy death animation

This commit is contained in:
2025-10-22 12:30:46 +01:00
parent f9a218159c
commit 4338abab62
8 changed files with 240 additions and 42 deletions

View File

@@ -1,9 +1,10 @@
[gd_scene load_steps=15 format=3 uid="uid://bvw0afyajdmht"]
[gd_scene load_steps=20 format=3 uid="uid://bvw0afyajdmht"]
[ext_resource type="Script" uid="uid://cxpc8xcf3r6rg" path="res://scripts/slime.gd" id="1_n6pvg"]
[ext_resource type="Texture2D" uid="uid://do7enjpf3pftb" path="res://assets/sprites/slime_green.png" id="1_p2gj0"]
[ext_resource type="PackedScene" uid="uid://dpox5fa2pojpo" path="res://scenes/killzone.tscn" id="2_n6pvg"]
[ext_resource type="PackedScene" uid="uid://bmv6eq8rt7fsb" path="res://scenes/hit_box.tscn" id="4_pjw23"]
[ext_resource type="PackedScene" uid="uid://jnqii6cg0cy" path="res://scenes/hit_box.tscn" id="4_pjw23"]
[ext_resource type="AudioStream" uid="uid://bhayvfhydadqy" path="res://assets/sounds/tap.wav" id="5_2npkn"]
[sub_resource type="CircleShape2D" id="CircleShape2D_pjw23"]
radius = 5.0
@@ -24,6 +25,22 @@ region = Rect2(48, 24, 24, 24)
atlas = ExtResource("1_p2gj0")
region = Rect2(72, 24, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_v5wyi"]
atlas = ExtResource("1_p2gj0")
region = Rect2(72, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_0l8pv"]
atlas = ExtResource("1_p2gj0")
region = Rect2(48, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_vnioy"]
atlas = ExtResource("1_p2gj0")
region = Rect2(24, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_2xjuo"]
atlas = ExtResource("1_p2gj0")
region = Rect2(0, 0, 24, 24)
[sub_resource type="SpriteFrames" id="SpriteFrames_v5wyi"]
animations = [{
"frames": [{
@@ -42,19 +59,193 @@ animations = [{
"loop": true,
"name": &"default",
"speed": 7.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_v5wyi")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0l8pv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vnioy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2xjuo")
}],
"loop": true,
"name": &"die",
"speed": 10.0
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0l8pv"]
size = Vector2(10, 9)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2npkn"]
size = Vector2(8, 3)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pjw23"]
size = Vector2(10, 2)
[sub_resource type="Animation" id="Animation_pjw23"]
resource_name = "die"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("CollisionShape2D:disabled")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sounds/Death:playing")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("RayCastRight:enabled")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("RayCastLeft:enabled")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Killzone/CollisionPolygon2D:disabled")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/5/type = "bezier"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("AnimatedSprite2D:rotation")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 1.134464, -0.083333336, -0.18907735, 0, 0),
"times": PackedFloat32Array(0, 0.26666668)
}
tracks/6/type = "method"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath(".")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(1),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"queue_free"
}]
}
[sub_resource type="Animation" id="Animation_2npkn"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("CollisionShape2D:disabled")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sounds/Death:playing")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("RayCastRight:enabled")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("RayCastLeft:enabled")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Killzone/CollisionPolygon2D:disabled")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/5/type = "bezier"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("AnimatedSprite2D:rotation")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_2npkn"]
_data = {
&"RESET": SubResource("Animation_2npkn"),
&"die": SubResource("Animation_pjw23")
}
@@ -68,22 +259,27 @@ position = Vector2(0, -6)
shape = SubResource("CircleShape2D_pjw23")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(0, -12)
position = Vector2(0, -8.755)
sprite_frames = SubResource("SpriteFrames_v5wyi")
animation = &"die"
autoplay = "default"
frame_progress = 0.45857617
offset = Vector2(0, -3.285)
[node name="HitBox" parent="." node_paths=PackedStringArray("animation_player", "animated_sprite") instance=ExtResource("4_pjw23")]
collision_mask = 2
animation_player = NodePath("../AnimationPlayer")
animation_name = "die"
animated_sprite = NodePath("../AnimatedSprite2D")
animated_sprite_name = "die"
[node name="CollisionShape2D" type="CollisionShape2D" parent="HitBox"]
position = Vector2(0, -11)
shape = SubResource("RectangleShape2D_pjw23")
[node name="Killzone" parent="." instance=ExtResource("2_n6pvg")]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Killzone"]
position = Vector2(0, -4.5)
shape = SubResource("RectangleShape2D_0l8pv")
[node name="HitBox" parent="." instance=ExtResource("4_pjw23")]
[node name="CollisionShape2D" type="CollisionShape2D" parent="HitBox"]
position = Vector2(0, -11.5)
shape = SubResource("RectangleShape2D_2npkn")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Killzone"]
polygon = PackedVector2Array(-7, 0, 7, 0, 7, -4, 5, -9, -5, -9, -7, -4)
[node name="RayCastRight" type="RayCast2D" parent="."]
position = Vector2(0, -6)
@@ -98,4 +294,8 @@ libraries = {
&"": SubResource("AnimationLibrary_2npkn")
}
[connection signal="killed" from="HitBox" to="." method="_on_hit_box_killed"]
[node name="Sounds" type="Node" parent="."]
[node name="Death" type="AudioStreamPlayer2D" parent="Sounds"]
stream = ExtResource("5_2npkn")
bus = &"SFX"