I am making a game using Java, LibGDX and Box2D. What would be the best way to create a player that can hold:
- no item
- one item from group A
- one item from group B
- one item from both groups
Items from group A can only be used to attack, and are held in the right hand.
Items from group B can only be used to defend, and are held in the left hand.
Should I add the item to the player class and render/update the item in the player class? Or is there any best way to this that I am not aware?
This is the best way I know how to do it:
I would also be interested in any design pattern that could be applied to this situation.