Hi guys, I’m making a fighting game. I was wondering what would be the best way to in a script that would recognize if their opponent was crouching when they attacked? So when the character is hit he plays a low collision animation.
If you just have crouching and standing set a boolean on the characters.
If you have more than crouching and standing and are using C# you can use an Enum:
http://www.csharp-station.com/Tutorials/lesson17.aspx
class MyChar : MonoBehavior {
public enum Stance{Crouching,Standing,Rolling,Jumping,Flying};
public Stance stance;
}
and then later do something like:
switch(opponent.stance) {
case(Stance.Crouching):
.//dosomething
break;
case(Stance.Standing):
//do something else
break;
....etc....