![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | DeerForMera |
So I have three BlendSpace2D (Idle, Walk and Attack) in my AnimationTree. My “Idle” and “Walk” are working but my “Attack” doesn’t work. All the three Animation have been connected with transition and the Attack already have AtEnd switch mode when travel back.
Here is my animation code
extends KinematicBody2D
onready var anim = $AnimationTree
onready var animstate = $AnimationTree.get("parameters/playback")
var vec = Vector2()
func _physics_process(delta):
vec = Vector2()
if Input.is_action_just_pressed("Attack"):
animstate.travel("Attack")
if vec == Vector2():
animstate.travel("Idle")
else:
animstate.travel("Walk")
anim.set("parameters/Walk/blend_position", vec)
anim.set("parameters/Idle/blend_position", vec)
anim.set("parameters/Attack/blend_position", vec)
move_and_slide(vec * speed)
I’m sure I make some mistake but I dont know where is it