OhNoItsATornahdo Posted October 20, 2017 Share Posted October 20, 2017 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/ Quote Link to comment Share on other sites More sharing options...
mattstyles Posted October 25, 2017 Share Posted October 25, 2017 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.