I want to make an inventory system

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Chevi

I want to make an inventory system where you equip the first item in a “TextureRect” node.
How I want to achieve this:

  • I have a ‘GridContainer’ node where my inventory is, I want it to get the texture ‘TextureRect’ it uses (In this example Iron Sword) and if it’s an Iron sword to change the sword sprite texture to an iron sword.

How I’ve tried to achieve this:

if $CanvasLayer/Interface/Inventory/GridContainer/One.texture.resource_path == 'res://Assets/PCs/Knight/Sword/Iron/portait.png':

pictures can be supplied if necessary.

:bust_in_silhouette: Reply From: deaton64

Maybe use an array to hold your inventory, you could have a grid array to match the GridContainer. Then the player can look in the inventory and grab an item and the GridContainer node could look in the array and populate itself.

Hard to say without knowing how you’ve done this. That’s what I’d do.

I haven’t watch this video, but Stefan’s tutorials are usually pretty good.

I’ll check it out later, thank you!

Chevi | 2020-07-27 22:05