Set animationtree to inactive until start to prevent editor conflict

This commit is contained in:
Steve Howes
2023-09-23 22:30:54 +01:00
parent 568be29bf7
commit 374dfa2361
2 changed files with 107 additions and 107 deletions
+5 -4
View File
@@ -8,7 +8,8 @@ extends CharacterBody2D
func _ready():
update_animation_parameters(starting_direction)
animation_tree.active = true;
func _physics_process(_delta):
var input_direction = Vector2(
Input.get_action_strength("right") - Input.get_action_strength("left"),
@@ -16,9 +17,9 @@ func _physics_process(_delta):
)
update_animation_parameters(input_direction)
input_direction = input_direction.normalized()
velocity = input_direction * move_speed
pick_new_state()
@@ -31,7 +32,7 @@ func update_animation_parameters(move_input: Vector2):
if(move_input != Vector2.ZERO):
animation_tree.set("parameters/Idle/blend_position", move_input)
animation_tree.set("parameters/Walk/blend_position", move_input)
func pick_new_state():
if(velocity != Vector2.ZERO):
state_machine.travel("Walk")