Buffer System For Items

Posted by Ohmages on Game Development See other posts from Game Development or by Ohmages
Published on 2012-09-16T12:32:56Z Indexed on 2012/09/16 15:52 UTC
Read the original article Hit count: 265

enter image description here

I am going to reference this image of what I want to accomplish in JavaScript.


This is the Diablo buffer system. This question may be a bit advanced (or possibly not even allowed). But I was wondering how you might go about implementing this type of system in a JavaScript game. Currently to implement such a system in JavaScript escapes me, and I am turning to SO to get some suggestions, ideas, and hopefully some insight in how I could accomplish this without being to costly on the CPU.

Some thoughts of mine for implementing such a system would be to:

  • Create DIVS within a DIV that hold each position of the inventory
  • Go through each item you own in a container and see which DIV it belongs to
  • Make said item images the DIVs image

This type of system might possibly work if ALL items were 1x1, but for this example its not going to work out.

I am at a complete lost of ideas how to even accomplish this. Although, maybe rendering directly to the canvas and checking mouse cords could work, there would more than likely be A HUGE annoyance when checking if other items are overlapping each other (meaning you cant place the item down, and possibly switching item with the cursor item ).

That said, what am I left with? Do I need to makeshift my own hack system with messy code, or is there some source out there (that I don't know about) that has replicated this type of system in their own game.

I would be very grateful to get some replies on how you might go about doing this, and will accept answers that can logically explain how you might implement such a system (code is not required).

P.S. Id like to use pure JavaScript, and nothing else (even though it might be "reinventing the wheel", I also like to learn).

© Game Development or respective owner

Related posts about JavaScript

Related posts about gui