I have done states for my different controls (idle, attack, roll, run), and attached an input_vector to an animation tree that has all 4 animations (the animation tree has a y length of 1.1 to favour left and right inputs). With this, my animation work in all 8 directions, even though I only have 4 different animations. This system works perfectly for my run, roll and idle animations (it works in all 8 directions), but it doesn't work for rolling. For rolling, the animations work for up, up and right, right, down and left, but it doesn't work for the other 3 diagonals. I want to fix this, but I am confused because it works for 5 directions, and all the other states work perfectly. Below is my script, and photos of the animation tree. Let me know if any other information is required to clarify my issue.
extends KinematicBody2D
const max_Speed = 100
const acceleration = 500
const friction = 500
enum {
move,
roll,
attack
}
var state = move
var velocity = Vector2.ZERO
var roll_vector = Vector2.DOWN
onready var animationPlayer = $AnimationPlayer
onready var animationTree = $AnimationTree
onready var animationState = animationTree.get("parameters/playback")
func _ready():
animationTree.active = true
func _physics_process(delta):
match state:
move:
move_state(delta)
roll:
roll_state(delta)
attack:
attack_state(delta)
func move_state(delta):
var input_vector = Vector2.ZERO
input_vector.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
input_vector.y = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")
input_vector = input_vector.normalized()
roll_vector = input_vector
if input_vector != Vector2.ZERO:
animationTree.set("parameters/Idle/blend_position", input_vector)
animationTree.set("parameters/Run/blend_position", input_vector)
animationTree.set("parameters/Attack/blend_position", input_vector)
animationTree.set("parameters/Roll/blend_position", input_vector)
animationState.travel("Run")
velocity = velocity.move_toward(input_vector * max_Speed, acceleration * delta)
else:
animationState.travel("Idle")
velocity = velocity.move_toward(Vector2.ZERO, friction * delta)
MOVE()
if Input.is_action_just_pressed("attack"):
state = attack
if Input.is_action_just_pressed("roll"):
state = roll
func attack_state(delta):
velocity = Vector2.ZERO
animationState.travel("Attack")
func roll_state(delta):
animationState.travel("Roll")
velocity = roll_vector * max_Speed * 1.5
MOVE()
func MOVE():
velocity = move_and_slide(velocity)
func roll_animation_finished():
velocity = velocity * 0.75
state = move
func attack_animation_finished():
state = move


To elaborate, the animation tree's blend position is set to be equal to input vector, with the different blend spaces (i.e. states) being activated by various inputs. So, when I press the attack key when MOVING, it only works in the 5 directions listed. However, after stopping the attacks work fine. I think thats because when moving the input vector is approx. (0.7, 0.7), but when standing still the input vector is set to be (0, 1) or (0, -1) depending on the direction of movement prior to standing still. I dont know if this is useful for solving the issue, but the more info the better