Hi Guys,
Wondering if I could get your thoughts on handling complex animation states? As my code is starting to get a bit spaghetti.
My player uses acceleration and deceleration to get a nice feel. But, things are starting to get complex as I add more states.
For example, if my player runs to the right, it accelerates nicely and decelerates if right is no longer pressed. If I push left (while the character is running right) deceleration is greater and I then play the turning animation and then eventually start accelerating in the other direction, back into a run sequence.
It starts getting more complex when I decide that I change my mind and want to run right again (mid turn), reversing the turn animation.
If have this all coded and working ok, but I have so many 'if' statements already.
There is a bunch of other things I want to do also, jump, climb, etc. Which will all have there own transistion animations also (like the turn animation does).
I'm just wondering how I can structure this better and get on top of the code logic before the actual code gets unmanageable.
Normally I would have clear states setup, but the added complexity of acceleration, transition frames, and being able to opt out of the action (in some cases - like turning) are making it difficult.
I'd love to know what the best approach would be in this scenario.
Thanks in advance