Godot Version
4.5.1
Question
this happened in my code why i tried to run the scene, it didnt show an error but it gives an error when i try running it
this is the code i was writing:
class_name Player
extends CharacterBody2D
@export var speed : float = 50
@export var animation_tree : AnimationTree
var input : Vector2
var playback : AnimationNodeStateMachinePlayback
func _ready():
playback = animation_tree["parameters/playback"]
func _physics_process(delta: float) -> void:
var input = Input.get_vector("left", "right", "up", "down")
velocity = input * speed
move_and_slide()
select_animation()
update_animation_parameters()
func select_animation():
if velocity == Vector2.ZERO:
playback.travel("Idle")
else:
playback.travel("Walk")
func update_animation_parameters():
if input == Vector2.ZERO:
return
animation_tree["parameters/Idle/blend_position"] = input
animation_tree["parameters/Walk/blend_position"] = input



