4.10 Animation Player

This commit is contained in:
siyahas 2024-11-07 01:50:02 +03:00
parent 9db613b344
commit 91f71a39fd
2 changed files with 94 additions and 9 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=4 format=3 uid="uid://cnt3xr237kdqs"] [gd_scene load_steps=7 format=3 uid="uid://cnt3xr237kdqs"]
[ext_resource type="Script" path="res://scripts/trap.gd" id="1_23awk"] [ext_resource type="Script" path="res://scripts/trap.gd" id="1_23awk"]
[ext_resource type="Texture2D" uid="uid://cjc6mebcg5lks" path="res://assets/textures/other/Saw.png" id="1_34mhg"] [ext_resource type="Texture2D" uid="uid://cjc6mebcg5lks" path="res://assets/textures/other/Saw.png" id="1_34mhg"]
@ -6,13 +6,48 @@
[sub_resource type="CircleShape2D" id="CircleShape2D_1ysy5"] [sub_resource type="CircleShape2D" id="CircleShape2D_1ysy5"]
radius = 18.0 radius = 18.0
[sub_resource type="Animation" id="Animation_0uemr"]
resource_name = "spin"
length = 0.400005
loop_mode = 1
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Area2D/Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7]
}
[sub_resource type="Animation" id="Animation_gqn61"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Area2D/Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_q37r8"]
_data = {
"RESET": SubResource("Animation_gqn61"),
"spin": SubResource("Animation_0uemr")
}
[node name="SawTrap" type="Node2D"] [node name="SawTrap" type="Node2D"]
script = ExtResource("1_23awk") script = ExtResource("1_23awk")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_34mhg")
hframes = 8
[node name="Area2D" type="Area2D" parent="."] [node name="Area2D" type="Area2D" parent="."]
collision_layer = 8 collision_layer = 8
collision_mask = 2 collision_mask = 2
@ -20,6 +55,14 @@ collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("CircleShape2D_1ysy5") shape = SubResource("CircleShape2D_1ysy5")
[node name="Sprite2D" type="Sprite2D" parent="Area2D"]
texture = ExtResource("1_34mhg")
hframes = 8
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_q37r8")
}
autoplay = "spin"
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"] [connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=4 format=3 uid="uid://cxfl4ogd53fb3"] [gd_scene load_steps=7 format=3 uid="uid://cxfl4ogd53fb3"]
[ext_resource type="Script" path="res://scripts/trap.gd" id="1_x0eb1"] [ext_resource type="Script" path="res://scripts/trap.gd" id="1_x0eb1"]
[ext_resource type="Texture2D" uid="uid://dblhlyit4rs5x" path="res://assets/textures/other/Spiked Ball.png" id="2_r55mb"] [ext_resource type="Texture2D" uid="uid://dblhlyit4rs5x" path="res://assets/textures/other/Spiked Ball.png" id="2_r55mb"]
@ -6,12 +6,47 @@
[sub_resource type="CircleShape2D" id="CircleShape2D_1ysy5"] [sub_resource type="CircleShape2D" id="CircleShape2D_1ysy5"]
radius = 11.0 radius = 11.0
[sub_resource type="Animation" id="Animation_qms3f"]
resource_name = "move"
length = 2.0
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Area2D:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(100, 0)]
}
[sub_resource type="Animation" id="Animation_7h84l"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Area2D:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_14ytm"]
_data = {
"RESET": SubResource("Animation_7h84l"),
"move": SubResource("Animation_qms3f")
}
[node name="SpikeBallTrap" type="Node2D"] [node name="SpikeBallTrap" type="Node2D"]
script = ExtResource("1_x0eb1") script = ExtResource("1_x0eb1")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("2_r55mb")
[node name="Area2D" type="Area2D" parent="."] [node name="Area2D" type="Area2D" parent="."]
collision_layer = 8 collision_layer = 8
collision_mask = 2 collision_mask = 2
@ -19,6 +54,13 @@ collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("CircleShape2D_1ysy5") shape = SubResource("CircleShape2D_1ysy5")
[node name="Sprite2D" type="Sprite2D" parent="Area2D"]
texture = ExtResource("2_r55mb")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_14ytm")
}
autoplay = "move"
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"] [connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]