Jump to content

Inventory system in point and click game.


OhNoItsATornahdo
 Share

Recommended Posts

I'm currently experimenting making an inventory system in JavaScript in preparation for hopefully making a point and click game. I've tried a few approaches, but they did not work, at least not well enough. So I was wondering if anyone would share their input in regards to what they would to implement something like this.

 

Here is the fiddle I've been using to experiment with this: https://jsfiddle.net/Static_Cloud/0oc9L2nd/5/

 

Link to comment
Share on other sites

What have you tried that didn't work out so well?

I imagine it would be something as simple as keeping a list of items connected to a container. So you'd need an interface for a container, that can accept items, and then you implement that container into different things, such as the player character or maybe the scene you are currently looking at.

You'd need some functions to create the objects you're moving around, then just have a list connected to a container that either contains actual instances to those objects you are creating or contains a reference to another list that contains all the items. This second approach sounds significantly harder but might give you some advantages based on your specific use-case.

By having a container interface you open up the possibility to expand to items (or other things) that also have an inventory, i.e. a chest full of items can be added to a character/scene inventory.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...