Animations improved

This commit is contained in:
Фёдор Веселов 2024-10-07 00:05:10 +05:00
commit ad18793543
35 changed files with 430 additions and 465 deletions

View file

@ -1,121 +1,92 @@
[gd_scene load_steps=11 format=3 uid="uid://hsllvtm3q34d"]
[gd_scene load_steps=16 format=3 uid="uid://bg7lomiorxo2c"]
[ext_resource type="Script" path="res://scripts/components/plants/RuntimePlantData.cs" id="1_2wmcw"]
[ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/templates/plant_template.tscn" id="1_bikjn"]
[ext_resource type="Texture2D" uid="uid://b3tuidu8dag8u" path="res://assets/sprites/atlases/plants/sunflower.png" id="2_fwcda"]
[ext_resource type="AnimationLibrary" uid="uid://yjytiuj4u7oh" path="res://resources/animations/plants/sunflower.res" id="3_btsik"]
[ext_resource type="Script" path="res://scripts/components/plants/PlantSunSpawner.cs" id="3_te0pl"]
[ext_resource type="PackedScene" uid="uid://bpekho7leatr5" path="res://scenes/sun.tscn" id="4_b8hls"]
[ext_resource type="Script" path="res://scripts/components/plants/behaviours/SunflowerBehaviour.cs" id="5_26je0"]
[sub_resource type="Animation" id="Animation_7b6ex"]
[sub_resource type="Animation" id="Animation_bfx6v"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:frame")
tracks/0/path = NodePath("AnimationTree:parameters/conditions/produce")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [12]
"values": [false]
}
[sub_resource type="Animation" id="Animation_w8qjp"]
resource_name = "idle"
length = 0.833342
loop_mode = 2
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667, 0.833333),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [4, 6, 8, 10, 12, 14]
}
[sub_resource type="Animation" id="Animation_18upv"]
resource_name = "produce"
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333, 0.666666),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [1, 3, 5, 7, 9, 11, 13, 15, 17]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("PlantSunSpawner")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.5),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"Spawn"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_piyjs"]
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ek2al"]
_data = {
"RESET": SubResource("Animation_7b6ex"),
"idle": SubResource("Animation_w8qjp"),
"produce": SubResource("Animation_18upv")
"RESET": SubResource("Animation_bfx6v")
}
[sub_resource type="RectangleShape2D" id="RectangleShape2D_626vr"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_lkpmx"]
animation = &"sunflower/idle"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_hc6hn"]
animation = &"sunflower/produce"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_26fia"]
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_d2akw"]
advance_mode = 2
advance_condition = &"produce"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_sww40"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_enpal"]
states/sunflower_idle/node = SubResource("AnimationNodeAnimation_lkpmx")
states/sunflower_idle/position = Vector2(371, 100)
states/sunflower_produce/node = SubResource("AnimationNodeAnimation_hc6hn")
states/sunflower_produce/position = Vector2(624, 99)
transitions = ["Start", "sunflower_idle", SubResource("AnimationNodeStateMachineTransition_26fia"), "sunflower_idle", "sunflower_produce", SubResource("AnimationNodeStateMachineTransition_d2akw"), "sunflower_produce", "sunflower_idle", SubResource("AnimationNodeStateMachineTransition_sww40")]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4xs4g"]
size = Vector2(26, 48)
[node name="Sunflower" type="Node2D"]
use_parent_material = true
script = ExtResource("1_2wmcw")
_maxHP = 100
[node name="Sunflower" instance=ExtResource("1_bikjn")]
[node name="Sprite" type="Sprite2D" parent="."]
use_parent_material = true
[node name="Sprite2D" parent="." index="0"]
texture = ExtResource("2_fwcda")
hframes = 2
vframes = 9
frame = 12
hframes = 9
vframes = 2
frame = 1
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
[node name="AnimationPlayer" parent="." index="1"]
libraries = {
"": SubResource("AnimationLibrary_piyjs")
"": SubResource("AnimationLibrary_ek2al"),
"sunflower": ExtResource("3_btsik")
}
autoplay = "idle"
[node name="Hitbox" type="Area2D" parent="."]
collision_layer = 2
collision_mask = 0
[node name="AnimationTree" parent="." index="2"]
tree_root = SubResource("AnimationNodeStateMachine_enpal")
parameters/conditions/produce = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
position = Vector2(0, 4)
shape = SubResource("RectangleShape2D_626vr")
[node name="PlantSunSpawner" type="Node2D" parent="."]
[node name="PlantSunSpawner" type="Node2D" parent="." index="3"]
position = Vector2(-2, 0)
script = ExtResource("3_te0pl")
_sunScene = ExtResource("4_b8hls")
_amountPerSun = 25
[node name="Behaviour" type="Node" parent="."]
[node name="Behaviour" type="Node" parent="." index="4"]
script = ExtResource("5_26je0")
[node name="Timer" type="Timer" parent="Behaviour"]
[node name="Timer" type="Timer" parent="Behaviour" index="0"]
wait_time = 5.0
autostart = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox" index="0"]
position = Vector2(0, 4)
shape = SubResource("RectangleShape2D_4xs4g")
[connection signal="timeout" from="Behaviour/Timer" to="Behaviour" method="Timeout"]