mirror of
https://github.com/stevenhowes/GodotTest.git
synced 2026-05-26 15:53:30 +01:00
Set animationtree to inactive until start to prevent editor conflict
This commit is contained in:
@@ -8,7 +8,8 @@ extends CharacterBody2D
|
|||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
update_animation_parameters(starting_direction)
|
update_animation_parameters(starting_direction)
|
||||||
|
animation_tree.active = true;
|
||||||
|
|
||||||
func _physics_process(_delta):
|
func _physics_process(_delta):
|
||||||
var input_direction = Vector2(
|
var input_direction = Vector2(
|
||||||
Input.get_action_strength("right") - Input.get_action_strength("left"),
|
Input.get_action_strength("right") - Input.get_action_strength("left"),
|
||||||
@@ -16,9 +17,9 @@ func _physics_process(_delta):
|
|||||||
)
|
)
|
||||||
|
|
||||||
update_animation_parameters(input_direction)
|
update_animation_parameters(input_direction)
|
||||||
|
|
||||||
input_direction = input_direction.normalized()
|
input_direction = input_direction.normalized()
|
||||||
|
|
||||||
velocity = input_direction * move_speed
|
velocity = input_direction * move_speed
|
||||||
|
|
||||||
pick_new_state()
|
pick_new_state()
|
||||||
@@ -31,7 +32,7 @@ func update_animation_parameters(move_input: Vector2):
|
|||||||
if(move_input != Vector2.ZERO):
|
if(move_input != Vector2.ZERO):
|
||||||
animation_tree.set("parameters/Idle/blend_position", move_input)
|
animation_tree.set("parameters/Idle/blend_position", move_input)
|
||||||
animation_tree.set("parameters/Walk/blend_position", move_input)
|
animation_tree.set("parameters/Walk/blend_position", move_input)
|
||||||
|
|
||||||
func pick_new_state():
|
func pick_new_state():
|
||||||
if(velocity != Vector2.ZERO):
|
if(velocity != Vector2.ZERO):
|
||||||
state_machine.travel("Walk")
|
state_machine.travel("Walk")
|
||||||
|
|||||||
+102
-103
@@ -6,23 +6,6 @@
|
|||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_f68x6"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_f68x6"]
|
||||||
size = Vector2(15, 23)
|
size = Vector2(15, 23)
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_we2gy"]
|
|
||||||
resource_name = "walk_right"
|
|
||||||
length = 0.5
|
|
||||||
loop_mode = 1
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/path = NodePath("Sprite2D:frame")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4),
|
|
||||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
|
||||||
"update": 1,
|
|
||||||
"values": [16, 17, 18, 19, 20]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_cvcr0"]
|
[sub_resource type="Animation" id="Animation_cvcr0"]
|
||||||
length = 0.001
|
length = 0.001
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
@@ -38,91 +21,6 @@ tracks/0/keys = {
|
|||||||
"values": [16]
|
"values": [16]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_gncbx"]
|
|
||||||
resource_name = "idle_right"
|
|
||||||
length = 3.0
|
|
||||||
loop_mode = 1
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/path = NodePath("Sprite2D:frame")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 2.9),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 1,
|
|
||||||
"values": [14, 15]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_isqws"]
|
|
||||||
resource_name = "idle_left"
|
|
||||||
length = 3.0
|
|
||||||
loop_mode = 1
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/path = NodePath("Sprite2D:frame")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 2.9),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 1,
|
|
||||||
"values": [21, 22]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_uh0nl"]
|
|
||||||
resource_name = "walk_left"
|
|
||||||
length = 0.5
|
|
||||||
loop_mode = 1
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/path = NodePath("Sprite2D:frame")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4),
|
|
||||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
|
||||||
"update": 1,
|
|
||||||
"values": [23, 24, 25, 26, 27]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_aqig2"]
|
|
||||||
resource_name = "walk_down"
|
|
||||||
length = 0.5
|
|
||||||
loop_mode = 1
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/path = NodePath("Sprite2D:frame")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4),
|
|
||||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
|
||||||
"update": 1,
|
|
||||||
"values": [9, 10, 11, 12, 13]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_odiyi"]
|
|
||||||
resource_name = "walk_up"
|
|
||||||
length = 0.5
|
|
||||||
loop_mode = 1
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/path = NodePath("Sprite2D:frame")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4),
|
|
||||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
|
||||||
"update": 1,
|
|
||||||
"values": [9, 10, 11, 12, 13]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_shhac"]
|
[sub_resource type="Animation" id="Animation_shhac"]
|
||||||
resource_name = "idle_down"
|
resource_name = "idle_down"
|
||||||
length = 3.0
|
length = 3.0
|
||||||
@@ -140,6 +38,40 @@ tracks/0/keys = {
|
|||||||
"values": [7, 8]
|
"values": [7, 8]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_isqws"]
|
||||||
|
resource_name = "idle_left"
|
||||||
|
length = 3.0
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 2.9),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [21, 22]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_gncbx"]
|
||||||
|
resource_name = "idle_right"
|
||||||
|
length = 3.0
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 2.9),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [14, 15]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_vg36w"]
|
[sub_resource type="Animation" id="Animation_vg36w"]
|
||||||
resource_name = "idle_up"
|
resource_name = "idle_up"
|
||||||
length = 3.0
|
length = 3.0
|
||||||
@@ -157,6 +89,74 @@ tracks/0/keys = {
|
|||||||
"values": [0, 1]
|
"values": [0, 1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_aqig2"]
|
||||||
|
resource_name = "walk_down"
|
||||||
|
length = 0.5
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [9, 10, 11, 12, 13]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_uh0nl"]
|
||||||
|
resource_name = "walk_left"
|
||||||
|
length = 0.5
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [23, 24, 25, 26, 27]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_we2gy"]
|
||||||
|
resource_name = "walk_right"
|
||||||
|
length = 0.5
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [16, 17, 18, 19, 20]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_odiyi"]
|
||||||
|
resource_name = "walk_up"
|
||||||
|
length = 0.5
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:frame")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [9, 10, 11, 12, 13]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_1a573"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_1a573"]
|
||||||
_data = {
|
_data = {
|
||||||
"RESET": SubResource("Animation_cvcr0"),
|
"RESET": SubResource("Animation_cvcr0"),
|
||||||
@@ -257,6 +257,5 @@ libraries = {
|
|||||||
[node name="AnimationTree" type="AnimationTree" parent="."]
|
[node name="AnimationTree" type="AnimationTree" parent="."]
|
||||||
tree_root = SubResource("AnimationNodeStateMachine_wgkrf")
|
tree_root = SubResource("AnimationNodeStateMachine_wgkrf")
|
||||||
anim_player = NodePath("../AnimationPlayer")
|
anim_player = NodePath("../AnimationPlayer")
|
||||||
active = true
|
|
||||||
parameters/Idle/blend_position = Vector2(0, -1)
|
parameters/Idle/blend_position = Vector2(0, -1)
|
||||||
parameters/Walk/blend_position = Vector2(0, 0)
|
parameters/Walk/blend_position = Vector2(0, 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user