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.