We have already talked about behavior states, where we define the possible actions of a character and how to link them. Animation state machines is a very similar process, but instead of defining the actions, we define the animations of a character. While developing the character and creating the behavior states, we could assign the animations in the action code, defining at which point the character starts to run, and once that happens, the walk animation stops and the run animation starts playing. This way of integrating the animations with the gameplay code looks like an easier approach to do it, but it's not the best way and it gets complicated if we want to update the code later on.
The solution to this problem ...