game inventory/bag system javascript html5 game

Posted by Tom Burman on Game Development See other posts from Game Development or by Tom Burman
Published on 2012-11-23T15:54:49Z Indexed on 2012/11/23 17:20 UTC
Read the original article Hit count: 771

Filed under:
|
|

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

© Game Development or respective owner

Related posts about game-design

Related posts about JavaScript