0 votes

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.

in Engine by (60 points)

1 Answer

0 votes

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.

by (1,861 points)

I'll check it out later, thank you!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.