Hmm, personally, I’d go along the lines of this:
//Make two arrays…
//This array will hold the names of the items in inventory.
var invName =[‘Key’,‘Bomb’,‘Torch’,‘M.Glass’];
//While this array holds the quantity the player has of each item.
var invQt =[1,0,3,0];
//If the player finds a key, you would increase the key quantity in
//the inventory like so:
/Just in case you, or someone else who’s reading this
doesn’t know how arrays work, basically, if you want to access
a value in an array you created, you call the array, followed by
square brackets. These [ ]. In between the brackets, type in the
number that equates to the parameter of the array that you want
to access. Keep in mind though that arrays are zero-indexed,
meaning, that instead of counting up from one, you start counting
//For example, using the inventory name array above:
//Key’s value is 0, while the value of M.glass is 3.
//Put even more simply:
var invName =[‘0Key’,‘1Bomb’,‘2Torch’,‘3M.Glass’];
//If the player used a bomb, you’d decrease their quantity of bombs
That’s basically it.
If you need anything else, don’t hesitate to ask.