All Questions

Community

Grominet

One line difference between lesson and final project

Hello, just to point out that in AttackAction.gd the line:

yield(Engine.get_main_loop(), "idle_frame")

is not present in the final project script.

Is there any particular reason?

  • Nathan Lovato replied

    In the final project, we have animations on which we yield, and so we don't need this yield call anymore. What makes the function a coroutine is that we pause execution at some point, and it's necessary for the caller to be able to yield() when calling this function: yield(_apply_async(), "completed")

    This, in turn, allows us to wait for the attack to complete. This could be anything: triggering dialogues, playing an animation, playing multiple animations, canceling the attack...