Inventory System for Escape the Room game

Hi all,

I could really use some help with creating an inventory system for an ‘escape the room’ type of game I’m trying to create. I’ve gotten the basic structure of the game done but am really struggling with how to apply an interactive inventory.

What I’m trying to do is when a player clicks on a pickable item, the item moves into the inventory slot located at the bottom of the screen. I then want the player to be able to either select the item in the inventory in order to use it (for example, select a crowbar to open a crate which contains a key, then the player can pick up the key, which goes into the inventory, in order to open a door to escape). It sounds simple, but I’m really struggling, even after doing some research and hours of trail and error. I’ve toyed with global variables, but no luck.

Can anyone help, preferably with images of code so I can understand how to do it.

Some examples of the type of game I am trying to create is below:

P.S. not to complicate the question but IF its easy to do, I’d like to make the inventory item draggable onto the screen so the player can test inventory items on other things (such as drag the crowbar from inventory onto the crate in order to open it).

Thanks in advance for any help you can offer!

You need to convert this into events. For the first sentence, it gives:
cursor/touch is on PickableItems, left click released ][ change position of PickableItems : set to InventorySlot.X() ; InventorySlot.Y()
Your turn for the other ones. :slight_smile:
Then show a screenshot of everything and we’ll help you fix it along the way.

Hi Gruk, thanks for your response. After a lot of digging around, I understand the theory of the inventory system on GDevelop, but I’ll be honest, I am completely lost on how to get it to work in my project. I tried MANY different variations with no success.

I’m sharing my game files via the link below in the hopes maybe you or some other expert on this forum can have a look and help me with the coding, and explain what I’ve been doing wrong.

Please let me know what you think. I’m completely at a loss here. Thank you!

Hi, can anyone please help with my question? I was able to figure out how to move items picked up into inventory slots, however, now I’m having issues figuring out how to carry over the inventory in those slots into a new scene.

The slots only fill up in the scene they are picked up, but when I move into another scene, they are gone. I believe this has something to do with ‘Save’ and ‘Load’, but I can’t figure it out and I’m completely lost now. Can someone help?

Thank you!

Try using Storare for the inventory naming each item and its qty. then load the storage to a variable and compare in a foreach the values if an item exist the change the slot animation

Thank you for the response. I understand the theory behind your suggestion, but I’m just so lost with how to actually apply it. Would you be able to expand on your explanation? Would you be able to provide screenshots perhaps?

I don’t know if you are using the built in inventory in GDevelop, this is how I do.

I have an Evensheet that runs first on all scenes to get/set all stuff of the game

In the GameScene my main Scene for all the game at the begin of the scene i check if strorage exist then load the stored values into a scene variable and load Inventory from that variable.

My inventory items are in a layer called PlayerInventory so at the begin call again to check if there are items there

To use an item and substract from the inventory, and save the Storage

Hope this helps

Thank you so much for providing this, I really appreciate it. I’m going to reference what you provided and try to apply it to my game. I’m new to this, so not sure I will fully be able to do so. This will help me start though.

Sure no problem if you need any help just tell me. Plus if you want to see that inventory system in action is on my game here