How to Make a Inventory

How do I create an Inventory that contains items you collect through out different scenes and saves them as well and can someone show me a visual representation of this?

1 Like

Hey maybe I can help a little, not sure if I have the full answer because I am working on inventories in my game as well.

So, you’re for sure going to need to learn about the Global Variables as that’s the only way I know of to track things between scenes.

There is a tutorial I just watched that will be of use to you I think, let me grab it.

You might also want to check out the simple inventory behavior that you can put in your projects. It might be able to handle everything that you need already.

Best of luck!

1 Like

I’m also making an inventory system. It kinda works like this:

Player in collision with Item

add Item.Animation::Name to Inventory
set Slot animation to Item.Animation::Name
delete Item

I basically have the Slot and Item object have a different animation for each item.

Thanks, but is there a way that the inventory layout and the items can save and I can access them throughout different scenes?

Like if I was in a dungeon scene and I needed an item that I collected in like a forest scene

Yes, global variables, so basically take your scene variables that you are using to store your items and convert them to global variables. Those stay throughout different scenes. You could then convert your global variables to their scene counterparts each time you load a new scene if you wanted. I skipped the scene variables and just stored everything in global for my project currently.

what about the scene variables?

or are they already explained within the video?

You will just have to change the scene variables to global variables so you can access them through different scenes thay work the same though

No I mean like making the scene variables for the inventory?

I wonder how this would work without animation and only in text. must be the same way…

I actually working on this… with global variables i change per button press in the scenes…

without the inventory.

dont know whats faster…

There should be an option the make variables if you go into your game setting and press variables the is where you make global for scene there will be 3 dots next to the name click it and then click variable

If you haven’t the solution yet, my template covers all of this. I’d be happy to review it with you over discord and help you get some hands on coaching if you need it.

Cheers,
LevelupWithAlex

Thanks, what’s yours username?

He username is levelupwithalex