I'm trying to code an inventory:
Code: Select all
image banana:
"gui/banana_idle.png"
size 50,50
default banana_item = Consumable("banana", 10, 10)
init python:
class Player:
def __init__(self, hunger, athletic, haggling, gaming, tolerance, charisma, logic, mmusic, cooking):
self.hunger = hunger
self.max_hunger = hunger
def addHunger(self, amount):
self.hunger += amount
if self.hunger > self.max_hunger:
self.hunger = self.max_hunger
class InventoryItem:
def __init__(self, img, value):
self.img = img
self.value = value
class Consumable(InventoryItem):
def __init__(self, img, value, hunger_gain):
InventoryItem.__init__(self, img, value)
self.hunger_gain = hunger_gain
def consumeEdible(self, target):
inventory.remove(self)
selected_item = None
global selected_item
target.addHUN(self.hunger_gain)
start:
$ inventory.append(banana_item)
When I play through it, the game opens fine, but when I open the inventory I get the error: TypeError: 'tuple' object is not callable
Does anyone have any advice on how to fix this? Am I coding the items wrong??