Search Unity

Tips on how to do jump attack?

Discussion in '2D' started by LagGit, Apr 13, 2015.

  1. LagGit

    LagGit

    Joined:
    Jan 28, 2014
    Posts:
    8
    Hi,

    I've set up my jump and fall animation using a blend tree like in this tutorial:
    http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-controllers

    I've also added a state in the animator controller called jumpattack and a trigger that is set when the attack button is tapped while in midair.

    The problem seems to be that it immedialy jumps back into the jump/fall animation because the vSpeed is changing, instead of playing the jumpattack animation..

    I would really appreciate any tips on how to achieve a jump attack, with or without a blend three for jump/fall. I can always change that.
     
  2. Redden44

    Redden44

    Joined:
    Nov 15, 2014
    Posts:
    159
    You could set a bool parameter true when the player push the attack button, then set the parameter false after x time with an Invoke or a Coroutine or an event in the animation window.

    When the parameter is true, you go from any state to the attack state and when it's false you go back to the any state.

    If you want to overwrite everything but the legs of the jump/fall animation, you need to put the attack animation on a different layer inside the animator window.
     
  3. LagGit

    LagGit

    Joined:
    Jan 28, 2014
    Posts:
    8
    Hi Redden44,

    I'll try looking into that, and see if i can get it to work that way.

    Thanks a lot for your reply.
     
  4. JoseSan02

    JoseSan02

    Joined:
    Oct 16, 2017
    Posts:
    1
    did you solve that problem¡? i have the same issues T_t
     
    TheUnaverageJoe likes this.