something wrong with eat() object function

May 2, 2020 at 04:09:02
Specs: Windows 10
it says that argument referenced before asigment.


class Player:
def __init__(self, name, attack, hp, armor, food, hunger, energy, mana):
self.name = name
self.attack = attack
self.hp = hp
self.armor = armor
self.food = food
self.hunger = hunger
self.energy = energy
self.mana = mana


def eat(self, x):
self.x = x
self.food = food
self.hunger = hunger
food = food - x
hunger = hunger + x


See More: something wrong with eat() object function

Reply ↓  Report •
Related Solutions


Ask Question