- Mar 15, 2021
- 458
- 575
i have a problem but i don't find how to fix
i have my class :
class Food(object):
def __init__(self,name,hgy,val,amount,ID):
self.name = name
self.hungry = hgy
self.val = val
self.amount = amount
self.ID = ID
def ConsumeFood(self):
self.amount -= 1
persistent.Food += self.hgy
if persistent.Food >= 10:
persistent.Food == 10
and i have a screen x
screen x:
showif inventory == True:
showif [inventory[3]].amount >= 1: Only will be display in inventory if the item exist
text"Amount: [inventory[3]].amount]": Show the amount of that item
xpos: whatever
ypos: whatever
textbutton "consume food":
action Function([inventory[3].ConsumeFood())
xpos: whatever
ypos: whatever
everthing works fine but the textbutton consume food works more than i want
as soon as you receive any food item it is automatically consumed
the button does not even appear but it is visible that it works because the amount of food increases.
anyone know how i can fix this ? I want the user to consume the food only when he clicks
i have my class :
class Food(object):
def __init__(self,name,hgy,val,amount,ID):
self.name = name
self.hungry = hgy
self.val = val
self.amount = amount
self.ID = ID
def ConsumeFood(self):
self.amount -= 1
persistent.Food += self.hgy
if persistent.Food >= 10:
persistent.Food == 10
and i have a screen x
screen x:
showif inventory == True:
showif [inventory[3]].amount >= 1: Only will be display in inventory if the item exist
text"Amount: [inventory[3]].amount]": Show the amount of that item
xpos: whatever
ypos: whatever
textbutton "consume food":
action Function([inventory[3].ConsumeFood())
xpos: whatever
ypos: whatever
everthing works fine but the textbutton consume food works more than i want
as soon as you receive any food item it is automatically consumed
the button does not even appear but it is visible that it works because the amount of food increases.
anyone know how i can fix this ? I want the user to consume the food only when he clicks
Last edited: