So basically, a problem I've had in past attempt at making games (little playing around with stuff): how to do a correct, non-sloppy way of planning the flow of animations/control?
Let's take an example: you have a character, that can walk in the 4 cardinal directions, and can attack. It's that simple. Obviously, you can only walk in one direction at the same time, and let's assume you can attack when not moving in a direction only.
How would you take upon implementing this? Don't know if I'm clear, but what'd your thinking process go like?
I always end up with a huge mess of ifs and else ifs to get the animations to represent what is actually supposed to happen after moving in a direction, ie. character after having moved up, will maintain it's upwards facing (will stay on the "up" animation); Have the facing direction when moving be consistent: if you start walking left, it gets the left animation, correct. Then you start walking upwards at the same time, or downwards, and you'd like the animation to keep @ being left. You start walking up, up animation. And as you start moving left or right after starting to move up, you maintain up animation.
See what I mean? I'll be here for clarifications on the question, sorry if confuse.
For 4 directions it'd not be that hard to do something "decently structured", but when things start adding up, it becomes so confuse!
Edit: Another thing I hadn't thought about: I was simply, upon WASD, altering the object's velocities, and handling all the animation stuff through what velocities were involved. Which leads to wrong things I had thought about, such as if I get pushed, it'd walk left stupidly instead of backing off facing the direction it had.
Another edit: What I want is an answer of the sort: "First, for movement, you'd have a look at all the possible directions, and have an int or such indicating what's the current direction. Do a big switch, and inside of each direction, you'd have ifs for further x and y, but not z, because that's gonna be englobed in whatever. Then you should also have another control layer directly on the input handling to help filter unwanted actions or combinations, such as, you don't want to press A and D and have the velocities cancel each other out. For such, you'd have some further "status" for the object..." something of this kind! Thanks!