Hello, I'm having problems manning multiple animations. Here's some pseudo code.
if( move left button ){
play move left animation
}
if( move right button ){
play move right animation
}
if( punch button ){
play punch animation
}
if( kick button ){
play kick animation
}
if( no buttons pressed ){
play idle animation
}
Generally if no buttons are pressed I want to play a looping idle animation. However, if move right and move left buttons are pressed I want to play a looping moving animation. However, if I press the punch button I want to play the punch animation.
However, the punch animation isn't interruptible. So I can only punch once. Also if I hold the move right button, the move right animation should play, but if I hit punch that should happen, then revert to the right move animation.
I've tried to program all of this, but there's a lot of ifs and else that it's getting extremely messy for something that should be quite simple.
How would you do this? Are there any common patterns to follow?