I’m working on a follow-up to my previous Renpy project, but I’m looking to make this one into a point and click rather than a Visual novel.
I managed to set up an inventory system, by stealing some code that I found on youtube.
The code is for a drag and drop inventory, but I’d rather items be automatically removed from your inventory as soon as you click on the object that needs them.
I have a python function for removing items from your inventory:
def removeInventoryItem(item): item.destroy() inventory_sprites.pop(inventory_sprites.index(item)) inventory_items.pop(inventory_items.index(item.type)) repositionInventoryItems()
and another for interacting with a bookshelf
elif item.type == “bookshelf”:
if “book” in inventory_items:
removeInventoryItem(“book”)
Currently, when I interact with the bookshelf while the book is in my inventory, I get this error
File"game/script.rpy", line 2011 in removeInventoryItem
item.destory()
Attribute Error: ‘str’ object has no attribute ‘destroy’
Hopefully the issue is my own inexperience and can be easily fixed.