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():
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user