All Questions


Jerry Smith

Need to connect to animation_finished signal...

Missing from _ready():

    anim_player.connect("animation_finished", self, "_on_AnimationPlayer_animation_finished")

  • S
    Jerry Smith replied

    I believe the following hookup is missing from Battler as well, or you may have done it in a lesson and I overlooked it.  I noticed that the battlers were not taking turns, and that the code was getting hung yielding to the animation_finished signals, which I wasn't firing due to missing the signal hookups.  

    (in the _ready() function of    

    battler_anim.connect("animation_finished", self, "_on_BattlerAnim_animation_finished")

  • Nathan Lovato replied

    It's not missing, but I think it's easy to miss the first instruction due to the lack of a screenshot. In the lesson, we connect the signals via the editor's signals tab.

    From the lesson:

    In the 2D workspace, connect each animation player nodes’ animation_finished signal to BattlerAnim. I connected them both to the same callback function, _on_AnimationPlayer_animation_finished().

    And, for the battler:

    We should also connect the animation_finished signal to the battler so we can make it available to the action, that will rely on it.