Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Mr. Gamezz |
I watched the entire tutorial series by arkeve on how to make an inventory system. I noticed that in the videos, There was nothing on how to actually use items in the hotbar. I tried making my own script which is written like this:
if Input.is_action_just_pressed("Click"):
if PlayerInventory.hotbar != {}:
print(PlayerInventory.hotbar)
PlayerInventory is a singleton btw.
When I run this line and click, It should print the hotbar because there is atleast on item in the hotbar dictionary. When I remove everything from the hotbar dictionary, It should print the hotbar because it is empty. It still prints it. Why is it doing this?
tl;dr The hotbar is equal to {} so it shouldn’t run the line but it still runs.