class_name Character extends CharacterBody2D @export var speed := 135.0 # Xf2RduncoNU func _physics_process(_delta: float) -> void: var new_direction = Vector2.ZERO if Input.is_action_pressed("left"): new_direction.x -= 1.0 if Input.is_action_pressed("right"): new_direction.x += 1.0 if Input.is_action_pressed("up"): new_direction.y -= 1.0 if Input.is_action_pressed("down"): new_direction.y += 1.0 new_direction = new_direction.normalized() velocity = new_direction * speed # oyvTZWUjCy0 var moving := velocity != Vector2.ZERO $AnimationTree["parameters/conditions/moving"] = moving $AnimationTree["parameters/conditions/not_moving"] = !moving if !moving: return $AnimationTree.set("parameters/walk/blend_position", new_direction) $AnimationTree.set("parameters/idle/blend_position", new_direction) move_and_slide()