game inventory/bag system javascript html5 game
- by Tom Burman
im building an RPG game using html5's canvas and javascript. Its tile based and im using an array to created my game map.
I would like the player to have a bag/inventory so when they select or land on a tile that has an item on it, they can click on it and store it in their bag/inventory.
I was thinking of using a 2d array to store the value of the item tile, a bit like my map is doing, so when the player lands on, lets say a rope tile which is tileID 4, the value 4 is pushed into the next array position available, then reloop through the array and reprint it to the screen.
For an example of what im trying to achieve visually, would be like runescapes inventory, but dumbed down a bit.
I appreciate any views and answers. Im not great at javascript coding so please be patient
Thanks Tom