the walking animation is a bit weird and here is the problem, for example you are walking left, but at the same time you press S to walk down and then let go of A, but the walking to the left animation is still playing. I have no idea where or what the problem is.
this is the code for animate and walking:
@onready var animationtree=$AnimationTree
@onready var state_machin= animationtree["parameters/playback"
enum {IDLE, RUN}
var state=IDLE
var blend_pos:Vector2=Vector2.ZERO
var blend_pos_path=[
"parameters/idle/idle_bs2d/blend_position" ,
"parameters/run/run_bs2d/blend_position"
]
var anime_state_key=[
"idle",
"run"
]
func move(delta):
var input_vector = Input.get_vector("ui_left","ui_right","ui_up","ui_down")
if input_vector==Vector2.ZERO:
state= IDLE
apply_friction(f*delta)
else:
state=RUN
apply_move(input_vector*Accel*delta)
blend_pos=input_vector
move_and_slide()
func animate()->void:
state_machin.travel(anime_state_key[state])
animationtree.set(blend_pos_path[state],blend_pos
func _physics_process(delta):
move(delta)
animate()
I wish i could have uploaded a video but i cant. the transition between animations doesnt work if you dont stop one. as i have said before, if you press A to walk left and without releasing the button, you press W or S, and then release the A button, the animation wont change.
the character animation has 4 directions not 8