This tutorial has been completely redone as of Sept/14/2015
Requirements
A basic understanding of Arrays and Functions if you wish to adapt it to your own needs.
How It Works
For this inventory we will be using a 2-dimensional array. Each element on the x-axis is a slot which contains the item ID (y=0) and the amount of that item (y=1) where an item ID of 0 is nothing. So an empty inventory would look like this:
Whereas an inventory where the first slot has 4x of item #3. The first slot is marked in red.
Setting It Up
Add an array
Let's go ahead and add our array first. Name it something useful like arr_inventory. Next decide how many slots you will have, and put that number into the arrays Width. Set the Height to 2, Depth to 1, and leave it be.
Add the objects
For this, we will need 2 objects. One will be for the slot and the other will be for the world item. Name the item object spr_groundItem. Next, add a frame for each object you will have. We will be using the ID 0 to represent no item like so:
Next add an item named spr_invSlot. Do the same thing as before with the frames and add a slot box in the image. I did a simple black border with the image inside. This object will require an instance variable named slotID. This also requires the first frame (frame 0) to be empty to represent no item.
Add a text object
This part isn't mandatory unless you want to display the amount in each slot. First create a new text object named txt_slotAmt and give it an instance variable named slotID.
Make it look pretty
Exactly what it sounds like, set up your slots and text objects so they look nice. The objects on top are our "ground items". The slotID's of the invSlot and slotAmt objects need to increment by 1 starting from 0. The first one on the left side is 0, ending at 3 on the right side.