- Home /
Left can Animate but right cannot. Why?
For some reason I have this probelm where the left animation for hitting works, but the right works part of the way.
My code:
if(xa.attacking && !xa.onSkateboard ) {
2. if(xa.facingDir==1){ 3. if (currentAStates!=xa.aStates.second && canA2==true ) { print("Second Attack");//second attack mySprite.PlayOnce("aRight" );//Attack Left currentAStates = xa.aStates.second; } 4. else if (currentAStates!=xa.aStates.third && canA3==true ) { print ("Third Attack");//third attack currentAStates = xa.aStates.third; mySprite.PlayOnce("GoSL" ); } 5. else if (currentAStates != xa.aStates.first && canA2!=true && canA3!=true){ mySprite.PlayOnce("aLeft" );//Attack Left print ("First Attack"); currentAStates = xa.aStates.first; } } 6. if(xa.facingDir==2){ if (currentAStates!=xa.aStates.second && canA2==true ) { print("Second Attack R");//second attack mySprite.PlayOnce("aLeft" );//Attack Left currentAStates = xa.aStates.second; } 7. else if (currentAStates!=xa.aStates.third && canA3==true ) { print ("Third Attack R");//third attack currentAStates = xa.aStates.third; mySprite.PlayOnce("GoSR" ); } 8. else if (currentAStates != xa.aStates.first && canA2!=true && canA3!=true){ mySprite.PlayOnce("aRight" );//Attack Left print ("First Attack R"); currentAStates = xa.aStates.first; } } }
Now I'm not sure what excatly isn't told but ill try and give the most information I can. If you have any questions just ask.
basicly the 1st if statement is asking if the the palyer is attacking and if s/he is on the skateboard. The anwser will always be yes, no for this example allowing it to move on.
the next if statement is checking the direction the player is facing (1=left, 2=right).
In the 3rd if Statement it checks if its attack state is second and if it can do second attack(canA2). 4 is the same but checking if it can do the third attack.
5th is if it can't do both 2nd and 3rd then it will do the 1st attack and become the 1st attack state. 2-5 work and they animate correctly. 6-8 work in the sense that all attacks are printed (which notifies me when it works), but it doesn't animate.
There is more code to it which changes the currentAStates(current attack state) but I don't think that is the probelm since it does seems to process through the code because it does the print "First Attack R" and does the first attack animation, but the 2nd and 3rd don't animate. Any idea on why this is happening? (Using Orthello2d)
Is there no answer to my question or did I not explain it well enough?
Your answer
![](https://koobas.hobune.stream/wayback/20220613092329im_/https://answers.unity.com/themes/thub/images/avi.jpg)