Fixed sunflower
This commit is contained in:
parent
83d36f53b2
commit
cca91bbece
2 changed files with 7 additions and 57 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=17 format=3 uid="uid://hsllvtm3q34d"]
|
[gd_scene load_steps=11 format=3 uid="uid://hsllvtm3q34d"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/components/plants/RuntimePlantData.cs" id="1_2wmcw"]
|
[ext_resource type="Script" path="res://scripts/components/plants/RuntimePlantData.cs" id="1_2wmcw"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b3tuidu8dag8u" path="res://assets/sprites/atlases/plants/sunflower.png" id="2_fwcda"]
|
[ext_resource type="Texture2D" uid="uid://b3tuidu8dag8u" path="res://assets/sprites/atlases/plants/sunflower.png" id="2_fwcda"]
|
||||||
|
|
@ -20,18 +20,6 @@ tracks/0/keys = {
|
||||||
"update": 1,
|
"update": 1,
|
||||||
"values": [12]
|
"values": [12]
|
||||||
}
|
}
|
||||||
tracks/1/type = "value"
|
|
||||||
tracks/1/imported = false
|
|
||||||
tracks/1/enabled = true
|
|
||||||
tracks/1/path = NodePath("AnimationTree:parameters/conditions/produce")
|
|
||||||
tracks/1/interp = 1
|
|
||||||
tracks/1/loop_wrap = true
|
|
||||||
tracks/1/keys = {
|
|
||||||
"times": PackedFloat32Array(0),
|
|
||||||
"transitions": PackedFloat32Array(1),
|
|
||||||
"update": 1,
|
|
||||||
"values": [false]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_w8qjp"]
|
[sub_resource type="Animation" id="Animation_w8qjp"]
|
||||||
resource_name = "idle"
|
resource_name = "idle"
|
||||||
|
|
@ -80,18 +68,6 @@ tracks/1/keys = {
|
||||||
"method": &"Spawn"
|
"method": &"Spawn"
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
tracks/2/type = "value"
|
|
||||||
tracks/2/imported = false
|
|
||||||
tracks/2/enabled = true
|
|
||||||
tracks/2/path = NodePath("AnimationTree:parameters/conditions/produce")
|
|
||||||
tracks/2/interp = 1
|
|
||||||
tracks/2/loop_wrap = true
|
|
||||||
tracks/2/keys = {
|
|
||||||
"times": PackedFloat32Array(0.5),
|
|
||||||
"transitions": PackedFloat32Array(1),
|
|
||||||
"update": 1,
|
|
||||||
"values": [false]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_piyjs"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_piyjs"]
|
||||||
_data = {
|
_data = {
|
||||||
|
|
@ -100,35 +76,12 @@ _data = {
|
||||||
"produce": SubResource("Animation_18upv")
|
"produce": SubResource("Animation_18upv")
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_eokqq"]
|
|
||||||
animation = &"idle"
|
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1pq1s"]
|
|
||||||
animation = &"produce"
|
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_51e4m"]
|
|
||||||
advance_mode = 2
|
|
||||||
advance_condition = &"produce"
|
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_rn41y"]
|
|
||||||
switch_mode = 2
|
|
||||||
advance_mode = 2
|
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_agd8v"]
|
|
||||||
advance_mode = 2
|
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_1ra8v"]
|
|
||||||
states/idle/node = SubResource("AnimationNodeAnimation_eokqq")
|
|
||||||
states/idle/position = Vector2(351, 100)
|
|
||||||
states/produce/node = SubResource("AnimationNodeAnimation_1pq1s")
|
|
||||||
states/produce/position = Vector2(659, 100)
|
|
||||||
transitions = ["idle", "produce", SubResource("AnimationNodeStateMachineTransition_51e4m"), "produce", "idle", SubResource("AnimationNodeStateMachineTransition_rn41y"), "Start", "idle", SubResource("AnimationNodeStateMachineTransition_agd8v")]
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_626vr"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_626vr"]
|
||||||
size = Vector2(26, 48)
|
size = Vector2(26, 48)
|
||||||
|
|
||||||
[node name="Sunflower" type="Node2D"]
|
[node name="Sunflower" type="Node2D"]
|
||||||
script = ExtResource("1_2wmcw")
|
script = ExtResource("1_2wmcw")
|
||||||
|
_maxHP = 100
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite2D" parent="."]
|
[node name="Sprite" type="Sprite2D" parent="."]
|
||||||
texture = ExtResource("2_fwcda")
|
texture = ExtResource("2_fwcda")
|
||||||
|
|
@ -140,11 +93,7 @@ frame = 12
|
||||||
libraries = {
|
libraries = {
|
||||||
"": SubResource("AnimationLibrary_piyjs")
|
"": SubResource("AnimationLibrary_piyjs")
|
||||||
}
|
}
|
||||||
|
autoplay = "idle"
|
||||||
[node name="AnimationTree" type="AnimationTree" parent="."]
|
|
||||||
tree_root = SubResource("AnimationNodeStateMachine_1ra8v")
|
|
||||||
anim_player = NodePath("../AnimationPlayer")
|
|
||||||
parameters/conditions/produce = false
|
|
||||||
|
|
||||||
[node name="Hitbox" type="Area2D" parent="."]
|
[node name="Hitbox" type="Area2D" parent="."]
|
||||||
collision_layer = 2
|
collision_layer = 2
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,17 @@ using System;
|
||||||
|
|
||||||
public partial class SunflowerBehaviour : Node
|
public partial class SunflowerBehaviour : Node
|
||||||
{
|
{
|
||||||
private AnimationTree _tree;
|
private AnimationPlayer _player;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_tree = GetNode<AnimationTree>("../AnimationTree");
|
_player = GetNode<AnimationPlayer>("../AnimationPlayer");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Timeout()
|
public void Timeout()
|
||||||
{
|
{
|
||||||
_tree.Set("parameters/conditions/produce",true);
|
_player.Play("produce");
|
||||||
|
_player.Queue("idle");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue