- Home /
After animation completion transition to default animation
Here I was facing problem in 2d sprite animation. On each button click, I want to play swatting animation of my player. By default its playing main animation, on button tap I was playing swat animation.
I want something like this, after completion of swatting animation, automatically I want to play default animation for player.
I tried this by setting boolean variable between two states, like this:
But at present animation always remain at swatting animation, didn't get back to default state.
If I detect animation complete event then all time its not detected if I press button multiple time continuously. So at last its stuck at last frame of swatting animation.
This kind of source code I was already using:
public void HitFlyingObstacles ()
{
if (isPineapplePowerUp)
myAnimator.SetBool ("IsPineappleSwat", true);
else
myAnimator.SetBool ("IsSwat", true);
}
public void SwatAnimationCcomplete ()
{
if (isPineapplePowerUp)
myAnimator.SetBool ("IsPineappleSwat", false);
else
myAnimator.SetBool ("IsSwat", false);
}
I want to play both animation in sequence, by default I want to play main animation, on tap of button I want to play swatting animation then return back to main animation after completion so its become normal cycle.
Please give me some suggestion to achieve target.
Answer by ismaelnascimento01 · May 26, 2017 at 12:45 PM
Do animation of your sprite with array, each click button to increment index of array.
Your answer
Follow this Question
Related Questions
2D Animation does not start 1 Answer
2D sprite animation issue 0 Answers
Change entire spriteSheet from animation tree 2 Answers
Animator - Stoping && Playing from Specific frames. 5 Answers
How to make not smooth animation? 0 Answers