andrew-peng-144 / js-explore-game

0 stars 0 forks source link

Item/inventory system #12

Open andrew-peng-144 opened 3 years ago

andrew-peng-144 commented 3 years ago

Clean.

Items are discrete, i.e. each item has its unique id. But items may have properties that are continuous or have too many states, or "modifiers"...

Player has inventory, a collection of items.

Weapons and equipment are just items with the data field specifying the type. like if its a weapon. what kind of weapon is the "class". Usually only can be 1 in a slot, but for things like throwing knives it can have multiple.

Zelda BOTW inventory is actually multiple inventories of categories- have something like this. Weapons, Potions, armor, materials, key items, and some fancy screens that lists some key things. So like in player, can have, weapon_inventory, potion_inventory, armor_inventory, etc.

For combat... how to choose which weapon's active? Assuming only one weapon can be used at a time (no dual wielding any two), then have a single pointer that points to the item that's active. Dont use "equipped" flags on items (because that implies very many items can be equipped at once).

Later should have some actors on the battlefield have similar inventories for combat? Usually like being able to switch weapons or use potions. Their inventories should be similar anyway, just a few slots with main weapons and consumables.