jheredia / pack-it-up

Frantic packing action game about a group of backpackers working together to complete their trip while trying to keep their luggage and sanity.
1 stars 1 forks source link

Inventory System & UI #8

Closed jheredia closed 1 week ago

jheredia commented 2 weeks ago

As a player, I need to have an inventory system that keeps track of the items I picked up during a level, it must also keep track of pickups that could appear on the level.

The inventory should have a method to clear every item present in it, on each level start, the inventory will be cleared, this can be achieved either by exposing the clear method or by reacting to an event signaling the start of the level.

The inventory system should have methods to add and to remove items from its set The add method should react to an event sent by the items that signal that a player picked up an item. The remove method could be exposed or could react to an event that signals that the player lost an specific item.

The inventory system should have a way to check whether all the mandatory items of a level have been collected, these mandatory items list should not live within this system but rather should be passed on level start. The method used to determine if all mandatory items are picked up should be exposed.

// To do, what happens when multiple players are present? Do they share the inventory? Should it be tied to the game state and not the player?

The inventory system should have a way to indicate how many items it has, this will be consulted on the end of the level.

The UI of the inventory system should update accordingly based on events, whenever an item is added, mark it in a way that the player clearly understands that they have it. Whenever a pickup is added to the inventory, update the UI to indicate the amount.

Some items might persist between levels, the clear method should have an option to either clear everything or to dispose only level items. By default, it should only dispose level items, if a boolean flag is passed as a parameter, it should completely clear its set.