Some basic player inventory system stuff (might do more later)

I made a couple projects to test basic player inventory systems. I noticed there are a few posts on the forum about this kind of thing already, but I felt like playing around and just seeing what I could come up with off the top of my head. So far I made two different types, and I might make more variations later if I feel like it.
*Edit:Added a third type

Type 1:
inventory-type-1.wick (19.6 KB)

Notes
  • Each space stores one item
  • New items are added to the end of the inventory
  • Every time you use up an item, remaining items are shifted left
  • Some items can only be used under certain conditions (also true for type 2)

Type 2:
inventory-type-2.wick (20.3 KB)

Notes
  • Each space stores one type of item
  • Each item has a max storage of 99
  • Some items can only be used under certain conditions (also true for type 1)

Type 3
inventory-type-2-select.wick (26.3 KB)

Notes
  • Same as type 2, but when you click an item in the inventory, it goes to the mouse cursor. Then you click on what you want to use that item on. If you click on nothing, or you click on something that the item can’t be used for, the item returns to your inventory.

You can use/adapt what’s here for your own projects if you’d like. Disclaimer that this is just an experiment, I don’t know how well these would work if implemented into a larger, more complex game. On a side note, since I was focused on the inventory stuff, I didn’t really polish the other aspects of these projects yet. (The one thing that’ll probably seem weird is that items that the player can pick up will spawn on top of each other sometimes. This is because I just randomized their positions without checking for collisions.)

3 Likes

can I use this for a game I am making

Yes! This is just a basic feature for a larger game, I tried to design it in a way that other people can use it. If you have any questions about how to change something in the project, you can also ask me.

1 Like

ok :slightly_smiling_face:

can you add a button that drops all your items

Yup, here are some adjustments to clear the inventory:
Type 1
inventory-type-1-empty.wick (20.3 KB)
Type 2
inventory-type-2-empty.wick (21.0 KB)

thanks :smiley:

I made an update to the type 2 inventory which is pretty good for items that can have multiple uses. It lets you select an item, and then you click on what you want to use the item for. I added it to the first post, under “type 3”.
For example, maybe the key could work for both a locked door or a locked chest, depending on which one you choose. You click on the key in your inventory, it goes to your mouse cursor, then you click on the object you want to use it on. If you don’t click on something you can use the key on, it goes back into your inventory.

Very very nice. @bluecake You are a great artist.

1 Like

in most of them it sais that theres an error

idk how to empliment it into my game like when I collect a pokemon Pokemon Project2-9-2022_7-42-41.wick (6.6 KB)

Hello @bluecake i realy like this Project and i would love to imploment the type 3 version. but i have a little problem. there is an error apearing when i try to test it out, look:

TypeError: Cannot read properties of undefined (reading 'gotoAndStop') at Wick.Clip.eval (eval at _evalScript (https://www.wickeditor.com/editor/corelibs/wick-engine/wickengine.js:56140:12), <anonymous>:5:34)

at Wick.Clip._runFunction (https://www.wickeditor.com/editor/corelibs/wick-engine/wickengine.js:56203:25)

    at Wick.Clip.runScript (https://www.wickeditor.com/editor/corelibs/wick-engine/wickengine.js:55999:24)

    at Wick.Clip._onActivated (https://www.wickeditor.com/editor/corelibs/wick-engine/wickengine.js:56049:10)

    at Wick.Clip._onActivated (https://www.wickeditor.com/editor/corelibs/wick-engine/wickengine.js:58358:11)

at Wick.Clip.tick (https://www.wickeditor.com/editor/corelibs/wick-engine/wickengine.js:56037:12)

at https://www.wickeditor.com/editor/corelibs/wick-engine/wickengine.js:57035:12

at Array.forEach (<anonymous>)

at Wick.Frame._tickChildren (https://www.wickeditor.com/editor/corelibs/wick-engine/wickengine.js:57034:16)

at Wick.Frame._onActivated (https://www.wickeditor.com/editor/corelibs/wick-engine/wickengine.js:57016:10)

@bluecake is gone. It is not with us since Jan 2021

2 Likes

oh sad :( he was a great adition to the wick editor comunity

3 Likes

I agree, they were an amazing person and I am so glad that they were once part of this glorious community.

3 Likes