To analyze the problems within the code you should remove only work on one thing at once.
Within the posted part there are three things:
- animating
- movement(jumping)
- state switching

Remove everything, but one of those, and get that working, before you add anything else. Or, make three test entities and test functions where you test each separately from each other. When you get the test functions working, combine them to the final code.