func adjust_item_collection(item_upgrade):
var get_item_displaynames = Dictionary.ITEMS[item_upgrade]["displayname"]
var get_collected_item_displaynames = []
for i in collected_items:
get_collected_displaynames.append(Dictionary.ITEMS[i]["displayname"])
if not get_item_displaynames in get_collected_item_displaynames:
var new_item_container = itemContainer.instantiate()
new_item_container.item_upgrade = item_upgrade
collectedItems.add_child(new_item_container)
The itemContainer is a TextureRect with this code.
extends TextureRect
#var spell_upgrade = null
var item_upgrade = null
@onready var itemTexture = $ItemTexture
@onready var colorRect = $ColorRect
@onready var nameLabel = $ColorRect/Name
@onready var levelLabel = $ColorRect/Level
@onready var detailLabel = $ColorRect/Detail
func _ready():
if item_upgrade != null:
itemTexture.texture = load(Dictionary.ITEMS[item_upgrade]["icon"])
nameLabel.text = Dictionary.ITEMS[item_upgrade]["displayname"]
levelLabel.text = Dictionary.ITEMS[item_upgrade]["level"]
detailLabel.text = Dictionary.ITEMS[item_upgrade]["details"]
func _on_mouse_entered():
colorRect.visible = true
func _on_mouse_exited():
colorRect.visible = false
I am reading this and I am still not quite sure what the problem is.
You have a functional Item-Compendium that lists items via itemID (which is ring1, ring2 etc) but you don’t want to show the prerequisite.
You don’t need to show it if you don’t want to?
Your code of the ItemContainer or Player don’t even use the prerequisite?
Maybe you meant that you want to FILTER your Dictionary.ITEMS for all items that have an empty prerequisite array? You can do that by using the filter method.
for itemID in Dictionary.ITEMS.keys():
if Dictionary.ITEMS[itemID].prerequisite.is_empty():
#do what you must