Godot Version
Godot Engine 4.3
Question
` Hi everyone! I wanted to ask you about how can I create an interactable item for the following inventory that I created:
extends CanvasLayer
var is_open = false
@export var inventory: Inventory
@onready var items_container: VBoxContainer = $Control/NinePatchRect/VBoxContainer
@onready var slots: Array = $Control/NinePatchRect/VBoxContainer.get_children()
func _ready():
update_inv()
close()
func _process(delta):
print(inventory.items)
func open():
show()
is_open = true
func close():
hide()
is_open = true
func update_inv():
for i in range(min(inventory.items.size(), slots.size())):
slots[i].update(inventory.items[i])
I have an Area2D with the class_name InteractableItem, I want to know how can I connect this inventory system with the object’s interaction, in update_inv()
function. Just in case, I have already tried to connect them with signals, but it didn’t work, what another solution do you give me? Thank you so much, I’ll be here waiting your possible solutions!
Inventory Item UI code:
extends Label
func update(item: InventoryItem):
if !item:
return
else:
text = item.item_name
`