Thursday Discount - Lifetime Access for $20!!!! - Click Here!

Inventory Properties

Add specific inventory to the GUI

The Inventory dictionary is used for any inventory you want to be visually depicted in the GUI. You can see how this looks in the image below. The inventory will have an icon based on an image you import, and can optionally show the current amount of that inventory item.

The actual artwork for the inventory looks like this…

So you can see the icon includes any kind of “backing” behind it you want. Which is less necessary if you choose not to show the current amount.

Here’s what’s the Inventory dictionary looks like in the property list…

Keep in mind, showing inventory for things the character collects is optional. Any of the Rewards dictionaries in the kit can give the player any kind of inventory of your choosing, but code-wise this simply saves the item name and how much of that item they have. By default, it doesn’t depict that inventory item in the GUI unless you create a dictionary of data in the Inventory dictionary.

The kit includes two examples of items that have Inventory data, the CastleKey and Diamond. Neither is hard-coded to go to a specific spot in the GUI. Whichever is collected first, would go to an invisible “placeholder” sprite in the GUI.sks file called Slot1. The next item would go to Slot2 and so on.

The Demo version  of the kit includes 4 placeholder slots. Like ALL items in the GUI.sks, they are children of TheCamera. So anywhere the camera moves, the GUI contained within move as well.

You can add as many placeholder Slots to the GUI as you want, just keep naming them sequentially Slot1, Slot2, Slot3, Slot4, Slot5, and so on.  Of course, screen real estate will eventually prevent you from add too many, but game-wise you should find that the character doesn’t need to collect too many things. For example, on the Grassland level, they collect the CastleKey to open the castle portal, but in doing so, the key is removed from inventory. So on the next level, they no longer have the key.

Let’s take a look at the properties…

  • Icon – this is the name of the image in the asset catalog representing the inventory.
  • ShowCount – a Bool value, if YES the kit will create a label relative to the icon which shows the current amount in inventory for this particular thing
  • CountOffset – a string value in {x, y} format to position where the label is in relation to the center of the icon.  So {15, -3} puts the label 15 points over to the right on the x axis, and down 3 on the y axis.
  • Font – the font name to use for the label. To see how to add custom fonts to the kit, watch this video.
  • Sound – this value will be the full file name including extension of a sound file to play when this inventory is first added.

 

 

 

 




Know what an affiliate program is? You make money just by sharing links to our site! Win. Win.

Earn when you refer any buyer here! 30 day tracking. Commissions are 33%-50% and recur on subscription products!