Game Development Reference
In-Depth Information
After this is all done, we stop the loop with break . Remember when we checked
whether the current invItems name was equal to "Empty" ? If it does happen to
be "Empty" , we use break again to stop the loop. We can't remove the item from
the inventory, since it is in the inventory to begin with!
With that, you now have the ability to remove items from the inventory. When the
player sells an item, shoots an arrow, use a health potion, or anything similar to these
situations, you can remove that specific item from the inventory. This may seem like
a daunting task, but there is a way around this. You can also use the Initial-
izeInventory function that we first created to reset the inventory, since that is es-
sentially what that function does.
Search WWH ::




Custom Search