This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
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':
   $SwordNode/SwordSprite.load("'res://Assets/PCs/Knight/Sword/Iron/sword.png")

pictures can be supplied if necessary.

in Engine by (63 points)

1 Answer

0 votes

Hi,
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 (2,065 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 Frequently asked questions and 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 [email protected] with your username.