Alas, I just tried rigging that, and was unsuccessful. Before I go on, i'll post a sample to make sure we had the same idea:
At the start of the function I have all the states and things seprated, this being a sample (once more, inH is the horizontal axis value):
if(inH > 0) {
facingRight = true;
facingLeft = false;
isMoving = true;
}
if(inH < 0) {
facingRight = false;
facingLeft = true;
isMoving = true;
}
if(inH == 0 && facingRight == true) {
isMoving = false;
}
Once all of those are done (and they all work as intended), I have the animation sections (in the same function):
if(isMoving == true && facingRight == true){
if (!anim.IsPlaying("hero_WalkR")) {
anim.Play("hero_WalkR");
}
}
if(isMoving == true && facingLeft == true){
if (!anim.IsPlaying("hero_WalkL")) {
anim.Play("hero_WalkL");
}
}
...and so forth. Unfortunately the results are the same, with the idle and walk animations working fine, but the jump and attack ones getting stuck on frame one. I also tried making another new animation to put in for jump as a test, but that did not make a difference either. I'm going to go ahead and post this, and am going to try something else. Right now, everything is in a MovementAnimations function being called in update. I'll start playing around with putting some of these in difference places, see if that makes any difference.
Edit 1: No luck yet, but I swapped the actual movement animation with the attack animation, and it played properly. At the very least that rules out there being something wrong with the actual animations
Edit 2: It's already late, but I think I'm onto something here. I commented out the walking animation script, and then if I was moving and held down the attack button, the attack animation would play. I think it has something to do with the idle/walk animations perhaps overwriting the others? More investigation is required
Edit 3: Yup, that's the problem, I haven't quite figured it out yet though, but here's some other things I noticed. If I leave the walk animations commented out, and move the jump animations above the idle animations, then jump and the ground attack animations will play ONLY when you are moving. However by doing this, then the air attack animation won't even trigger at all, and of course there is no walk animation. If you have any suggestions that would always be helpful, but I think I'll need to keep rearranging things until I find something that works. I'll keep this thread updated.