Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

2d attack animation while turning

Discussion in '2D' started by Dedi6, Jan 21, 2020.

  1. Dedi6

    Dedi6

    Joined:
    Jan 20, 2019
    Posts:
    119
    Hello, (2D)

    I've implemented an attack animation recently, but since the animation was being flipped when,if, the player attacked and quickly switched direction, I made the animation go back to Idle when turning while attacking.
    But, if you turn really quick, the animation doesn't play long enough. I mean, it quickly shuts down. So I've tried to make a sort of a "key frame" for the attack animation(the main frame of the animation), triggering it when turning, also later on I put it on a coroutine to wait for a couple of frames, but none of the above really worked. Triggering the key frame animation didnt prevent it from flipping while the animation is playing, if you turn quickly. Is there a way to prevent the animation from flipping? I implemented a timer that prevents the character from flipping for a short time when attacking, but it feels weird sort of moonwalking for like 3 frames.. I will use it if I won't be able to fix this tho.

    Thank you !