You say it doesn’t do what you want, but what does it do? Does it do nothing, or does it skip the animation and do something else?
First thing that seems interesting to me is await is_on_floor
. You can’t await
on things that aren’t signals, so if this isn’t a signal that you’re emitting somewhere, then this won’t work.
The second thing to be careful of is that while the code after await
runs later, the execution path that hits the await
the first time returns immediately to keep the engine from locking up.
So if somewhere else in your code you have:
func _process(_delta):
if something_something:
bird_nest_animation()
change_scene()
or something, then the execution path will go into bird_nest_animation
and run jump
, hit the await
and immediately return, and then run change_scene
in the parent context. Then, at some time later, the rest of the code in bird_nest_animation
might run, but it doesn’t matter because we’ve already moved on.
If you take the jump
and the await
out of the code (or even just the await
), does the animation play like you expect? If so, it’s probably that which is causing trouble.
Even if the await
wasn’t the problem, though, play
also doesn’t block, so I assume somewhere you’re looking for the finished_animation
animation to end before you do whatever it is you do to get out of this cutscene?
Sorry if you already knew all this, and everything I’ve said is useless