Hello again!
Given my previous success with this forum, I thought I'd ask for your opinions once again! I've been all over Google, but I haven't
really found anything that helps with something this specific, I suppose.
I currently have an animation class within my game. All objects that have any screen time (players, monsters, props, bullets, etc)
basically keep an instance of this class. This means that if an object's state changes (ie. dying, jumping, attacking, etc), the animation
can follow over the top of this entity and then change on demand, depending on what it needs to do.
Now, all of these entities inherit a single base class. This class has an abstract method inside that all child class must implement
called MakeChangesToAnimation() which is called in the base update. All child classes therefore have a method in which they can
tweak the animation depending on the object's current state. For example, if the character attacks, you could have a few lines of
code saying "if attackType == Attacks.Uppercut -> animation.sheetPosX = 0, animation.sheetPosX = 2, animation.frameSpeed = 5" or something like that.
This seems to work fine, but does lead to some slightly ugly code, as it becomes a messy mixture of nested if statements.
Also, the player has about 30 different animations, and the code to make sure the correct strips of the sprite sheet play is just this
awful jungle of nested if statements and repeated code. Is this the best way to go about animation, or would you recommend something
a bit more graceful?