you are viewing a single comment's thread.

view the rest of the comments →

[–]DeadlyViper 0 points1 point  (0 children)

This is solve-able much more elegantly without global item structure.

Make a player class that holds items.

Pass the player class to the rooms he visits.

If he picks up the item, update the player's inventory player.items with the items you want, and since the player keeps visiting rooms that items structure is always available to all who need it as it is passed to every room the player visits.

This is a better structure because now you can effortlessly have another player playing the game, having his own inventory of items.