Problems with a simple inventory system with the ItemList Node

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

I started to make a simple inventory system. My Scenetree looks like this:

Inventory(Node2d)
–Control
----ItemList

And I have a Code, which is attached to the Inventory(Node2d):

func _ready():
#At first, I add ten items to my Inventory:
for i in 10:        
    $Control/ItemList.add_item("",load("res://Sprites/Blume1.png"),true)

func _on_ItemList_item_selected(index):  
    #Here I try to attach the selected Item to my cursor:
    var ItemSelected = $Control/ItemList.get_item_icon(index)
    Input.set_custom_mouse_cursor(ItemSelected)
    $Control/ItemList.remove_item(index)

My problems are:

  1. When I select a Item and attach it to the cursor and remove it from the ItemList, I want that there, where the Item was before, is a gab. But actually, the other Items are moving to the left and top, so that there is no gab anymore.
  2. The size of the custom mouse courser is very small. How can I incress the size of the custom coursor?
:bust_in_silhouette: Reply From: njamster

When I select a Item […] from the ItemList, I want that there, where the Item was before, is a gab.

You’ll have to code this yourself, something like this should work:

$Control/ItemList.set_item_icon(index, load("res://transparent.png")
$Control/ItemList.set_item_disabled(index, true)

The size of the custom mouse courser is very small.

The mouse cursor size is capped at 250 x 250 pixels. If your cursor is smaller than that, just use a bigger texture and the cursor will become bigger as well.