I have a “design pattern” problem. I want to enable for a player to change his state. Lets say I have three states or super powers if you will. Each of them have different abilities. If this abilities were just based on some attributes (lets say mass or speed) I could just change that on the player and everything would work fine.
But what if there are some other functionalities changed. Lets say if the player is in the state 2 and he jumps the animation is different and some other thing changes. Now I know I could make this with a lot of checking in update loop for states but I want to make this elegant.
My idea until now is to make generalPlayer object and the each special player inherits from it and adds special abilities, and when player change state I would kind of change instance of player to that instance.
Is there any better way?