Ok so I’m working on a 2d platformer with a random melee attacks system. Currently the animator works like this:
There are 3 attack animations. You can go from idle to any one of them depending on random.range in the script, and you can return to idle. You can go from run to any attack but you can’t return to run without going to idle first. The player is supposed to attack when you get the attack axis from cross-platform input manager (yes, it’s a mobile game). When you get that axis, you set the trigger for any one of the three attack animations depending on what random.range returns and movement is stopped by setting the rigidbody2d’s velocity to 0
Well, the problem is that when I play the game on my multi touch android device, and I hold the left or right movement button and at the same time, keep tapping the attack button, the character runs, stops and attacks and the cycle repeats. That’s perfectly fine, but when you stop pressing the buttons after your chaotic button presses, the character repeats a max of 3 attack animations by itself!
I have tried like crazy to fix it up but I can’t come up with anything! So here’s the controller script: http://Pastebin.com/vzuv5dLB
Looking forward to some help.