Game Development Reference
In-Depth Information
Next, we add the new item to our items list by creating a new
KeyValuePair
vari-
able and assigning its key to the iterator and its value to
NewItem
. Finally, we add
the new item's amount by adding it to the
itemCount
list. This is done by creat-
ing another new
KeyValuePair
variable. We assign the new
KeyValuePair
vari-
able's key to the iterator and its value to the
val
variable.
With this, you now have the capability to add new items to your inventory. When
adding the items, you can add as many as you want. If you want only one of the new
items in the inventory, just set
HowMany
to
1
, and if you want to remove one, set it to
-1
.