Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | cristixxx |
Hy, i don’t know how to change the animation back to idle when the attack anim has finished. Here is the code:
func _physics_process(delta):
motion.y+=GRAVITY
if Input.is_action_pressed("ui_right"):
motion.x=SPEED
$AnimatedSprite.flip_h=false
if is_on_floor():
$AnimatedSprite.play("walk")
elif Input.is_action_pressed("ui_left"):
motion.x=-SPEED
$AnimatedSprite.flip_h=true
if is_on_floor():
$AnimatedSprite.play("walk")
elif is_on_floor():
motion.x=0
$AnimatedSprite.play("idle")
if is_on_floor() and Input.is_action_just_pressed("ui_up"):
motion.y=JUMP
if is_on_floor() and Input.is_action_just_pressed("attack"):
$AnimatedSprite.play("attack1")
if !is_on_floor():
$AnimatedSprite.play("jump")
motion=move_and_slide(motion,UP)
Did you solve the problem?
BrunoFreezee | 2018-06-15 18:15