Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Ferfar |
Ok, so this is pretty straight forward. I’ve been having trouble trying to make the game wait until a animation is finished playing. I tried several things, including the yield function but I cannot make it work. Please, if anyone can help me out!
Below you can see the part of my code I’m working on
extends KinematicBody2D
var motion = Vector2()
func _ready():
#var y = _physics_process(delta)
#y.resume()
print ("starting")
func _physics_process(delta):
...
...
if is_on_floor():
if Input.is_action_just_pressed("ui_up"):
$AnimatedSprite.play("jump")
yield(get_node("AnimatedSprite"), "finished") #<-Supposed to wait
motion.y += JUMP_HEIGHT #makes player go up
else:
$AnimatedSprite.play("idle")