vendredi 6 mai 2022

What is the differences between a strategy, state, and decorator pattern

Right now im trying to make inventory for pocket monster game, im stuck on bags system, there are several bags, inventory owns bags.A bag contain items. When the user is trying to look through one of the bag and the bag will take items from the "main bag" and create an instance of bag and sorts items in inside itself. I guess I am really asking is it worth to create multiple instances of different bags(key item, berries, etc) in the start of the game or just implement strategy or state when user look at the inventory and just show that to the user. Based on the game itself, the inventory is divided into different bags that contains its own types of items, so I'm now a bit confused on which one to use, strategy, decorator, or state.

Aucun commentaire:

Enregistrer un commentaire